Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/ash
- run_latehook() {
- # Mount zram/tmpfs/ramfs root
- for memfs in ${memfs//,/ }; do
- if [ "$memfs" = "tmpfs" ]; then
- mount -t tmpfs tmpfs /mnt
- elif [ "$memfs" = "ramfs" ]; then
- mount -t ramfs -o size=1024m ramfs /mnt
- elif [ "$memfs" = "zram" ]; then
- modprobe zram num_devices=3
- echo 1073741824 > /sys/block/zram0/disksize
- mkfs.ext4 /dev/zram0
- mount -t ext4 /dev/zram0 /mnt
- fi
- done
- # Unpack rootfs
- msg "Unpacking rootfs..."
- cd /mnt
- path=${path//,/ }
- for archfs in ${archfs//,/ }; do
- if [ "$archfs" = "xz" ]; then
- xz -d < /new_root/$path/archfs.xz | cpio -imd --no-absolute-filenames > /dev/null 2>&1
- elif [ "$archfs" = "gzip" ]; then
- gzip -dc /new_root/$path/archfs.gz | cpio -imd --no-absolute-filenames > /dev/null 2>&1
- elif [ "$archfs" = "lzo" ]; then
- lzop -d < /new_root/$path/archfs.lzo | cpio -imd --no-absolute-filenames > /dev/null 2>&1
- elif [ "$archfs" = "img" ]; then
- cpio -imd --no-absolute-filenames /new_root/boot/archfs.img > /dev/null 2>&1
- fi
- done
- # Switch tmpfs to new root
- umount /new_root
- mount -M /mnt /new_root
- }
- # vim: set ft=sh ts=4 sw=4 et:
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement