eth0s/rootfs/sbin/lfs-install

48 lines
857 B
Text
Raw Normal View History

2019-10-16 17:23:02 +08:00
#!/bin/bash
LFSMOUNT=$1
if [ ! "$LFSMOUNT" ]; then
2019-11-05 00:27:01 +08:00
cat << EOF
Usage:
$(basename $0) <path to install>
Example:
$(basename $0) /mnt/lfs
Note:
You should first configure partition then mount it somewhere
EOF
2019-10-16 17:23:02 +08:00
exit 1
fi
if ! mountpoint -q $LFSMOUNT; then
echo "'$LFSMOUNT' is not a mountpoint!"
exit 1
fi
if [ -f "/run/initramfs/ram/root.sfs" ]; then
ROOTSFS="/run/initramfs/ram/root.sfs"
elif [ -f "/run/initramfs/medium/lfs/root.sfs" ]; then
ROOTSFS="/run/initramfs/medium/lfs/root.sfs"
else
echo "squashed image not found!"
exit 1
fi
unsquashfs -f -i -d $LFSMOUNT $ROOTSFS
if [ "$?" = "0" ]; then
2019-11-05 00:27:01 +08:00
echo
2019-10-16 17:23:02 +08:00
echo "Successfully installed to '$LFSMOUNT'"
2019-11-05 00:27:01 +08:00
echo
echo "Run 'lfs-chroot $LFSMOUNT' to chroot into $LFSMOUNT."
echo "Then start configure your new installation."
2019-10-16 17:23:02 +08:00
else
echo "failed to install lfs system"
exit 1
fi
exit 0