v0.3 - Now with extra progressbar!

master
Robert "ar" Gerus 2013-04-30 04:02:30 +02:00
parent 73cf5d5027
commit b41afe0687
2 changed files with 18 additions and 12 deletions

30
init
View File

@ -43,7 +43,7 @@ isok $?
info "looking for device with rootfs" info "looking for device with rootfs"
for var in $(cat /proc/cmdline); do for var in $(cat /proc/cmdline); do
if [[ ${var/=*} = rootfs_location_uuid ]]; then if [[ ${var/=*} = rootfs_location_uuid ]]; then
uuid=${var/*=} uuid="${var/*=}"
fi fi
done done
device=$(findfs UUID=${uuid}) device=$(findfs UUID=${uuid})
@ -53,12 +53,24 @@ isok $?
info "getting rootfs filename" info "getting rootfs filename"
for var in $(cat /proc/cmdline); do for var in $(cat /proc/cmdline); do
if [[ ${var/=*} = rootfs_filename ]]; then if [[ ${var/=*} = rootfs_filename ]]; then
filename=${var/*=} filename="${var/*=}"
fi fi
done done
if [[ -z ${filename} ]]; then if [[ -z ${filename} ]]; then
info "going with default" info "going with default: rootfs.tar.xz"
filename=rootfs.tar.xz filename="rootfs.tar.xz"
fi
isok 0
info "getting root tmpfs size"
for var in $(cat /proc/cmdline); do
if [[ ${var/=*} = rootfs_size ]]; then
size=${var/*=}
fi
done
if [[ -z ${size} ]]; then
info "going with default: 4G"
size="4G"
fi fi
isok 0 isok 0
@ -67,7 +79,7 @@ info "trying to mount ${device}"
isok $? isok $?
info "trying to mount root tmpfs" info "trying to mount root tmpfs"
/busybox mount -n -o size=4G -t tmpfs roottmpfs /roottmpfs /busybox mount -n -o size=${size} -t tmpfs roottmpfs /roottmpfs
isok $? isok $?
info "checking if ${filename} exists" info "checking if ${filename} exists"
@ -75,13 +87,7 @@ info "checking if ${filename} exists"
isok $? isok $?
info "unpacking; will take some time" info "unpacking; will take some time"
( /pv /mnt/${filename} | /busybox tar -C /roottmpfs -xJf -
/busybox tar -C /roottmpfs -xJf /mnt/${filename}
isok $?
) &
# progress dots
echo ""
while [[ ! -z "$(jobs)" ]]; do echo -n .; jobs>/dev/null ; sleep 1; done
info "unmounting rootfs package location" info "unmounting rootfs package location"
/busybox umount -n /mnt /busybox umount -n /mnt

BIN
pv Executable file

Binary file not shown.