xbps-casper: sync with Ubuntu 1.236 version.

This commit is contained in:
Juan RP 2010-05-17 17:44:20 +02:00
parent a214baad07
commit 438b6f3650
11 changed files with 30 additions and 17 deletions

View file

@ -25,7 +25,8 @@ manual_add_modules aufs
copy_exec /sbin/losetup /sbin copy_exec /sbin/losetup /sbin
# Casper hooks # 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/cdrom_id /lib/udev
copy_exec /lib/udev/path_id /lib/udev copy_exec /lib/udev/path_id /lib/udev

View file

@ -18,6 +18,7 @@ HOST=live
BUILD_SYSTEM=Custom BUILD_SYSTEM=Custom
mkdir -p $mountpoint mkdir -p $mountpoint
tried=/tmp/tried
[ -f /etc/casper.conf ] && . /etc/casper.conf [ -f /etc/casper.conf ] && . /etc/casper.conf
export USERNAME USERFULLNAME HOST BUILD_SYSTEM export USERNAME USERFULLNAME HOST BUILD_SYSTEM
@ -31,8 +32,6 @@ fi
parse_cmdline() { parse_cmdline() {
for x in $(cat /proc/cmdline); do for x in $(cat /proc/cmdline); do
case $x in case $x in
toram)
export TORAM='Yes' ;;
showmounts|show-cow) showmounts|show-cow)
export SHOWMOUNTS='Yes' ;; export SHOWMOUNTS='Yes' ;;
persistent) persistent)
@ -52,8 +51,11 @@ parse_cmdline() {
live-media-path=*) live-media-path=*)
LIVE_MEDIA_PATH="${x#live-media-path=}" LIVE_MEDIA_PATH="${x#live-media-path=}"
export LIVE_MEDIA_PATH export LIVE_MEDIA_PATH
echo "export LIVE_MEDIA_PATH=\"$LIVE_MEDIA_PATH\"" \ echo "export LIVE_MEDIA_PATH=\"$LIVE_MEDIA_PATH\"" >> /etc/casper.conf ;;
>> /etc/casper.conf ;; toram)
export TORAM="Yes" ;;
todisk=*)
export TODISK="${x#todisk=}" ;;
esac esac
done done
if [ "${UNIONFS}" = "" ]; then if [ "${UNIONFS}" = "" ]; then
@ -130,7 +132,11 @@ mount_images_in_directory() {
is_nice_device() { is_nice_device() {
sysfs_path="${1#/sys}" 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 return 0
fi fi
return 1 return 1
@ -145,7 +151,7 @@ copy_live_to() {
if [ "${copytodev}" = "ram" ]; then if [ "${copytodev}" = "ram" ]; then
# copying to ram: # 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" mount_options="-o size=${size}k"
free_string="memory" free_string="memory"
fstype="tmpfs" fstype="tmpfs"
@ -262,7 +268,7 @@ do_snap_copy ()
todev=$(cat /proc/mounts | grep -s " $(base_path ${todir}) " | awk '{print $1}' ) todev=$(cat /proc/mounts | grep -s " $(base_path ${todir}) " | awk '{print $1}' )
freespace=$(df -k | grep -s ${todev} | awk '{print $4}') freespace=$(df -k | grep -s ${todev} | awk '{print $4}')
else 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 fi
tomount="/mnt/tmpsnap" tomount="/mnt/tmpsnap"
@ -493,6 +499,8 @@ check_dev ()
fi fi
fi fi
[ -e "$devname" ] || continue
if [ -n "${LIVEMEDIA_OFFSET}" ]; then if [ -n "${LIVEMEDIA_OFFSET}" ]; then
loopdevname=$(setup_loop "${devname}" "loop" "/sys/block/loop*" "${LIVEMEDIA_OFFSET}") loopdevname=$(setup_loop "${devname}" "loop" "/sys/block/loop*" "${LIVEMEDIA_OFFSET}")
devname="${loopdevname}" devname="${loopdevname}"
@ -500,7 +508,10 @@ check_dev ()
fstype=$(get_fstype "${devname}") fstype=$(get_fstype "${devname}")
if is_supported_fs ${fstype}; then 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 mount -t ${fstype} -o ro,noatime "${devname}" $mountpoint || continue
[ -n "$devuid" ] && echo "$devuid" >> $tried
if is_casper_path $mountpoint && \ if is_casper_path $mountpoint && \
([ "$skip_uuid_check" ] || matches_uuid $mountpoint); then ([ "$skip_uuid_check" ] || matches_uuid $mountpoint); then
echo $mountpoint echo $mountpoint
@ -534,6 +545,7 @@ find_livefs() {
for sysblock in \ for sysblock in \
$(echo /sys/block/* | tr ' ' '\n' | grep -vE "/(loop|ram|fd)"); do $(echo /sys/block/* | tr ' ' '\n' | grep -vE "/(loop|ram|fd)"); do
devname=$(sys2dev "${sysblock}") devname=$(sys2dev "${sysblock}")
[ -e "$devname" ] || continue
fstype=$(get_fstype "${devname}") fstype=$(get_fstype "${devname}")
if /lib/udev/cdrom_id ${devname} > /dev/null; then if /lib/udev/cdrom_id ${devname} > /dev/null; then
if check_dev "null" "${devname}" ; then if check_dev "null" "${devname}" ; then

View file

@ -3,7 +3,7 @@
PREREQ="" PREREQ=""
DESCRIPTION="Setting up /cdrom mountpoint" DESCRIPTION="Setting up /cdrom mountpoint"
. /scripts/casper-functions [ -r /scripts/casper-functions ] && . /scripts/casper-functions
prereqs() prereqs()
{ {

View file

@ -3,7 +3,7 @@
PREREQ="" PREREQ=""
DESCRIPTION="Setting up live session user '$USERNAME'" DESCRIPTION="Setting up live session user '$USERNAME'"
. /scripts/casper-functions [ -r /scripts/casper-functions ] && . /scripts/casper-functions
prereqs() prereqs()
{ {

View file

@ -3,7 +3,7 @@
PREREQ="" PREREQ=""
DESCRIPTION="Setting up system keymap" DESCRIPTION="Setting up system keymap"
. /scripts/casper-functions [ -r /scripts/casper-functions ] && . /scripts/casper-functions
prereqs() prereqs()
{ {

View file

@ -4,7 +4,7 @@ PREREQ=""
DESCRIPTION="Setting up /etc/fstab" DESCRIPTION="Setting up /etc/fstab"
FSTAB=${rootmnt}/etc/fstab FSTAB=${rootmnt}/etc/fstab
. /scripts/casper-functions [ -r /scripts/casper-functions ] && . /scripts/casper-functions
prereqs() prereqs()
{ {

View file

@ -4,7 +4,7 @@ PREREQ=""
DESCRIPTION="Setting up swap" DESCRIPTION="Setting up swap"
FSTAB=${rootmnt}/etc/fstab FSTAB=${rootmnt}/etc/fstab
. /scripts/casper-functions [ -r /scripts/casper-functions ] && . /scripts/casper-functions
prereqs() prereqs()
{ {

View file

@ -3,7 +3,7 @@
PREREQ="" PREREQ=""
DESCRIPTION="Setting up system locale" DESCRIPTION="Setting up system locale"
. /scripts/casper-functions [ -r /scripts/casper-functions ] && . /scripts/casper-functions
prereqs() prereqs()
{ {

View file

@ -3,7 +3,7 @@
PREREQ="" PREREQ=""
DESCRIPTION="Setting up automatic login" DESCRIPTION="Setting up automatic login"
. /scripts/casper-functions [ -r /scripts/casper-functions ] && . /scripts/casper-functions
prereqs() prereqs()
{ {

View file

@ -3,7 +3,7 @@
PREREQ="" PREREQ=""
DESCRIPTION="Setting up hostname" DESCRIPTION="Setting up hostname"
. /scripts/casper-functions [ -r /scripts/casper-functions ] && . /scripts/casper-functions
prereqs() prereqs()
{ {

View file

@ -1,6 +1,6 @@
# Template file for 'xbps-casper' # Template file for 'xbps-casper'
pkgname=xbps-casper pkgname=xbps-casper
version=0.4.1 version=0.5.ubuntu1.236
build_style=custom-install build_style=custom-install
short_desc="Run a live preinstalled system from read-only media" short_desc="Run a live preinstalled system from read-only media"
maintainer="Juan RP <xtraeme@gmail.com>" maintainer="Juan RP <xtraeme@gmail.com>"