#!/bin/bash LFSMOUNT=$1 if [ ! "$LFSMOUNT" ]; then cat << EOF Usage: $(basename $0) Example: $(basename $0) /mnt/lfs Note: You should first configure partition then mount it somewhere EOF 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 echo echo "Successfully installed to '$LFSMOUNT'" echo echo "Run 'lfs-chroot $LFSMOUNT' to chroot into $LFSMOUNT." echo "Then start configure your new installation." else echo "failed to install lfs system" exit 1 fi exit 0