From 438b6f36508d1a92c929b63f463290c3949cbbb2 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Mon, 17 May 2010 17:44:20 +0200 Subject: [PATCH] xbps-casper: sync with Ubuntu 1.236 version. --- srcpkgs/xbps-casper/files/hooks/casper | 3 ++- srcpkgs/xbps-casper/files/scripts/casper | 26 ++++++++++++++----- .../files/scripts/casper-bottom/05mountpoints | 2 +- .../files/scripts/casper-bottom/10adduser | 2 +- .../files/scripts/casper-bottom/11keymap | 2 +- .../files/scripts/casper-bottom/12fstab | 2 +- .../files/scripts/casper-bottom/13swap | 2 +- .../files/scripts/casper-bottom/14locales | 2 +- .../files/scripts/casper-bottom/15autologin | 2 +- .../files/scripts/casper-bottom/18hostname | 2 +- srcpkgs/xbps-casper/template | 2 +- 11 files changed, 30 insertions(+), 17 deletions(-) diff --git a/srcpkgs/xbps-casper/files/hooks/casper b/srcpkgs/xbps-casper/files/hooks/casper index 66fdbc772e..3f9c832689 100755 --- a/srcpkgs/xbps-casper/files/hooks/casper +++ b/srcpkgs/xbps-casper/files/hooks/casper @@ -25,7 +25,8 @@ manual_add_modules aufs copy_exec /sbin/losetup /sbin # Casper hooks -mkdir -p ${DESTDIR}/lib/udev +mkdir -p ${DESTDIR}/lib/udev/rules.d +cp -p /lib/udev/rules.d/60-cdrom_id.rules ${DESTDIR}/lib/udev/rules.d/ copy_exec /lib/udev/cdrom_id /lib/udev copy_exec /lib/udev/path_id /lib/udev diff --git a/srcpkgs/xbps-casper/files/scripts/casper b/srcpkgs/xbps-casper/files/scripts/casper index d44b79c523..d534ad6391 100644 --- a/srcpkgs/xbps-casper/files/scripts/casper +++ b/srcpkgs/xbps-casper/files/scripts/casper @@ -18,6 +18,7 @@ HOST=live BUILD_SYSTEM=Custom mkdir -p $mountpoint +tried=/tmp/tried [ -f /etc/casper.conf ] && . /etc/casper.conf export USERNAME USERFULLNAME HOST BUILD_SYSTEM @@ -31,8 +32,6 @@ fi parse_cmdline() { for x in $(cat /proc/cmdline); do case $x in - toram) - export TORAM='Yes' ;; showmounts|show-cow) export SHOWMOUNTS='Yes' ;; persistent) @@ -52,8 +51,11 @@ parse_cmdline() { live-media-path=*) LIVE_MEDIA_PATH="${x#live-media-path=}" export LIVE_MEDIA_PATH - echo "export LIVE_MEDIA_PATH=\"$LIVE_MEDIA_PATH\"" \ - >> /etc/casper.conf ;; + echo "export LIVE_MEDIA_PATH=\"$LIVE_MEDIA_PATH\"" >> /etc/casper.conf ;; + toram) + export TORAM="Yes" ;; + todisk=*) + export TODISK="${x#todisk=}" ;; esac done if [ "${UNIONFS}" = "" ]; then @@ -130,7 +132,11 @@ mount_images_in_directory() { is_nice_device() { sysfs_path="${1#/sys}" - if /lib/udev/path_id "${sysfs_path}" | grep -E -q "ID_PATH=(usb|pci-[^-]*-(ide|scsi|usb)|platform-mmc|platform-mxsdhci)"; then + if /lib/udev/path_id "${sysfs_path}" | egrep -q "ID_PATH=(usb|pci-[^-]*-(ide|scsi|usb)|platform-orion-ehci|platform- +mmc|platform-mxsdhci)"; then + return 0 + fi + if echo ${sysfs_path} | grep -q "^/block/dm-"; then return 0 fi return 1 @@ -145,7 +151,7 @@ copy_live_to() { if [ "${copytodev}" = "ram" ]; then # copying to ram: - freespace=$( expr $(awk '/MemFree/{print $2}' /proc/meminfo) + $( cat /proc/meminfo | grep Cached | head -n 1 | awk '/Cached/{print $2}' - ) ) + freespace=$(awk '/^MemFree:/{f=$2} /^Cached:/{c=$2} END{print f+c}' /proc/meminfo) mount_options="-o size=${size}k" free_string="memory" fstype="tmpfs" @@ -262,7 +268,7 @@ do_snap_copy () todev=$(cat /proc/mounts | grep -s " $(base_path ${todir}) " | awk '{print $1}' ) freespace=$(df -k | grep -s ${todev} | awk '{print $4}') else - freespace=$( expr $(awk '/MemFree/{print $2}' /proc/meminfo) + $( cat /proc/meminfo | grep Cached | head -n 1 | awk '/Cached/{print $2}' - )) + freespace=$(awk '/^MemFree:/{f=$2} /^Cached:/{c=$2} END{print f+c}' /proc/meminfo) fi tomount="/mnt/tmpsnap" @@ -493,6 +499,8 @@ check_dev () fi fi + [ -e "$devname" ] || continue + if [ -n "${LIVEMEDIA_OFFSET}" ]; then loopdevname=$(setup_loop "${devname}" "loop" "/sys/block/loop*" "${LIVEMEDIA_OFFSET}") devname="${loopdevname}" @@ -500,7 +508,10 @@ check_dev () fstype=$(get_fstype "${devname}") if is_supported_fs ${fstype}; then + devuid=$(blkid -o value -s UUID "$devname") + [ -n "$devuid" ] && grep -qs "\<$devuid\>" $tried && continue mount -t ${fstype} -o ro,noatime "${devname}" $mountpoint || continue + [ -n "$devuid" ] && echo "$devuid" >> $tried if is_casper_path $mountpoint && \ ([ "$skip_uuid_check" ] || matches_uuid $mountpoint); then echo $mountpoint @@ -534,6 +545,7 @@ find_livefs() { for sysblock in \ $(echo /sys/block/* | tr ' ' '\n' | grep -vE "/(loop|ram|fd)"); do devname=$(sys2dev "${sysblock}") + [ -e "$devname" ] || continue fstype=$(get_fstype "${devname}") if /lib/udev/cdrom_id ${devname} > /dev/null; then if check_dev "null" "${devname}" ; then diff --git a/srcpkgs/xbps-casper/files/scripts/casper-bottom/05mountpoints b/srcpkgs/xbps-casper/files/scripts/casper-bottom/05mountpoints index ca5ee5eb67..d85b2dab0a 100755 --- a/srcpkgs/xbps-casper/files/scripts/casper-bottom/05mountpoints +++ b/srcpkgs/xbps-casper/files/scripts/casper-bottom/05mountpoints @@ -3,7 +3,7 @@ PREREQ="" DESCRIPTION="Setting up /cdrom mountpoint" -. /scripts/casper-functions +[ -r /scripts/casper-functions ] && . /scripts/casper-functions prereqs() { diff --git a/srcpkgs/xbps-casper/files/scripts/casper-bottom/10adduser b/srcpkgs/xbps-casper/files/scripts/casper-bottom/10adduser index 264167b16a..6911c660b3 100755 --- a/srcpkgs/xbps-casper/files/scripts/casper-bottom/10adduser +++ b/srcpkgs/xbps-casper/files/scripts/casper-bottom/10adduser @@ -3,7 +3,7 @@ PREREQ="" DESCRIPTION="Setting up live session user '$USERNAME'" -. /scripts/casper-functions +[ -r /scripts/casper-functions ] && . /scripts/casper-functions prereqs() { diff --git a/srcpkgs/xbps-casper/files/scripts/casper-bottom/11keymap b/srcpkgs/xbps-casper/files/scripts/casper-bottom/11keymap index 2cb0eb55f0..203c30ae13 100755 --- a/srcpkgs/xbps-casper/files/scripts/casper-bottom/11keymap +++ b/srcpkgs/xbps-casper/files/scripts/casper-bottom/11keymap @@ -3,7 +3,7 @@ PREREQ="" DESCRIPTION="Setting up system keymap" -. /scripts/casper-functions +[ -r /scripts/casper-functions ] && . /scripts/casper-functions prereqs() { diff --git a/srcpkgs/xbps-casper/files/scripts/casper-bottom/12fstab b/srcpkgs/xbps-casper/files/scripts/casper-bottom/12fstab index 6fdf5032ed..23f6cf26ae 100755 --- a/srcpkgs/xbps-casper/files/scripts/casper-bottom/12fstab +++ b/srcpkgs/xbps-casper/files/scripts/casper-bottom/12fstab @@ -4,7 +4,7 @@ PREREQ="" DESCRIPTION="Setting up /etc/fstab" FSTAB=${rootmnt}/etc/fstab -. /scripts/casper-functions +[ -r /scripts/casper-functions ] && . /scripts/casper-functions prereqs() { diff --git a/srcpkgs/xbps-casper/files/scripts/casper-bottom/13swap b/srcpkgs/xbps-casper/files/scripts/casper-bottom/13swap index 8f75989bf4..e53ff5c1c7 100755 --- a/srcpkgs/xbps-casper/files/scripts/casper-bottom/13swap +++ b/srcpkgs/xbps-casper/files/scripts/casper-bottom/13swap @@ -4,7 +4,7 @@ PREREQ="" DESCRIPTION="Setting up swap" FSTAB=${rootmnt}/etc/fstab -. /scripts/casper-functions +[ -r /scripts/casper-functions ] && . /scripts/casper-functions prereqs() { diff --git a/srcpkgs/xbps-casper/files/scripts/casper-bottom/14locales b/srcpkgs/xbps-casper/files/scripts/casper-bottom/14locales index da1a7dd541..6002f35ce1 100755 --- a/srcpkgs/xbps-casper/files/scripts/casper-bottom/14locales +++ b/srcpkgs/xbps-casper/files/scripts/casper-bottom/14locales @@ -3,7 +3,7 @@ PREREQ="" DESCRIPTION="Setting up system locale" -. /scripts/casper-functions +[ -r /scripts/casper-functions ] && . /scripts/casper-functions prereqs() { diff --git a/srcpkgs/xbps-casper/files/scripts/casper-bottom/15autologin b/srcpkgs/xbps-casper/files/scripts/casper-bottom/15autologin index ac094bccbe..88ef987285 100755 --- a/srcpkgs/xbps-casper/files/scripts/casper-bottom/15autologin +++ b/srcpkgs/xbps-casper/files/scripts/casper-bottom/15autologin @@ -3,7 +3,7 @@ PREREQ="" DESCRIPTION="Setting up automatic login" -. /scripts/casper-functions +[ -r /scripts/casper-functions ] && . /scripts/casper-functions prereqs() { diff --git a/srcpkgs/xbps-casper/files/scripts/casper-bottom/18hostname b/srcpkgs/xbps-casper/files/scripts/casper-bottom/18hostname index 311a4b068b..9eba97dd14 100755 --- a/srcpkgs/xbps-casper/files/scripts/casper-bottom/18hostname +++ b/srcpkgs/xbps-casper/files/scripts/casper-bottom/18hostname @@ -3,7 +3,7 @@ PREREQ="" DESCRIPTION="Setting up hostname" -. /scripts/casper-functions +[ -r /scripts/casper-functions ] && . /scripts/casper-functions prereqs() { diff --git a/srcpkgs/xbps-casper/template b/srcpkgs/xbps-casper/template index 8cffa5e693..76d5ff47bb 100644 --- a/srcpkgs/xbps-casper/template +++ b/srcpkgs/xbps-casper/template @@ -1,6 +1,6 @@ # Template file for 'xbps-casper' pkgname=xbps-casper -version=0.4.1 +version=0.5.ubuntu1.236 build_style=custom-install short_desc="Run a live preinstalled system from read-only media" maintainer="Juan RP "