cleanup script provided
This commit is contained in:
+10
-22
@@ -2,34 +2,22 @@
|
||||
# Initial script for Linux Live Kit
|
||||
# Author: Tomas M <http://www.linux-live.org/>
|
||||
|
||||
# This is needed to enable pivot_root
|
||||
# We simply switch initramfs to mounted ramfs
|
||||
if [ ! -r /lib/root_switched ]; then
|
||||
echo "switch root from initramfs to ramfs"
|
||||
SWITCH=/m
|
||||
mkdir -p $SWITCH
|
||||
mount -t ramfs ramfs $SWITCH
|
||||
cp -a /* $SWITCH 2>/dev/null
|
||||
cd $SWITCH
|
||||
touch $SWITCH/lib/root_switched
|
||||
exec switch_root -c /dev/console . $0
|
||||
fi
|
||||
|
||||
MOUNTDIR=/mnt
|
||||
CHANGES=$MOUNTDIR/changes
|
||||
MEMORY=$MOUNTDIR/memory
|
||||
UNION=$MOUNTDIR/union
|
||||
DATAMNT=$MOUNTDIR/data
|
||||
BUNDLES=$MOUNTDIR/bundles
|
||||
|
||||
export PATH=.:/:/usr/sbin:/usr/bin:/sbin:/bin
|
||||
|
||||
. /lib/.config
|
||||
. /lib/livekitlib
|
||||
|
||||
transfer_initramfs
|
||||
|
||||
MEMORY=/memory
|
||||
CHANGES=$MEMORY/changes
|
||||
UNION=$MEMORY/union
|
||||
DATAMNT=$MEMORY/data
|
||||
BUNDLES=$MEMORY/bundles
|
||||
|
||||
header "Starting $LIVEKITNAME ..."
|
||||
|
||||
init_proc
|
||||
init_proc_sysfs
|
||||
init_devs
|
||||
init_aufs
|
||||
init_zram
|
||||
@@ -50,5 +38,5 @@ fstab_create "$UNION"
|
||||
header "Live Kit phase ends, starting $LIVEKITNAME"
|
||||
change_root "$UNION"
|
||||
|
||||
header "!!ERROR!!"
|
||||
header "!!ERROR occured, you shouldn't be here.!!"
|
||||
/bin/sh
|
||||
|
||||
@@ -62,6 +62,7 @@ mknod $INITRAMFS/dev/tty4 c 4 4
|
||||
#done
|
||||
|
||||
copy_including_deps /usr/bin/strace
|
||||
copy_including_deps /usr/bin/lsof
|
||||
|
||||
# TODO: add all comon filesystems which are NOT compiled in kernel already
|
||||
copy_including_deps /$LMK/kernel/fs/squashfs
|
||||
@@ -74,8 +75,12 @@ depmod -b $INITRAMFS
|
||||
echo "root::0:0::/root:/bin/bash" >$INITRAMFS/etc/passwd
|
||||
touch $INITRAMFS/etc/{m,fs}tab
|
||||
|
||||
cp init $INITRAMFS/
|
||||
cp init $INITRAMFS
|
||||
chmod a+x $INITRAMFS/init
|
||||
cp cleanup $INITRAMFS/lib
|
||||
chmod a+x $INITRAMFS/lib/cleanup
|
||||
ln -s ../init $INITRAMFS/bin/init
|
||||
ln -s ../init $INITRAMFS/sbin/init
|
||||
cp ../livekitlib $INITRAMFS/lib/
|
||||
cp ../.config $INITRAMFS/lib/
|
||||
|
||||
@@ -84,4 +89,4 @@ find . -print | cpio -o -H newc 2>/dev/null | gzip -f --best >$INITRAMFS.img
|
||||
echo $INITRAMFS.img
|
||||
|
||||
cd ..
|
||||
#rm -Rf $INITRAMFS
|
||||
rm -Rf $INITRAMFS
|
||||
|
||||
Reference in New Issue
Block a user