diff options
Diffstat (limited to 'core/scripts/setup-install.sh')
-rw-r--r-- | core/scripts/setup-install.sh | 183 |
1 files changed, 183 insertions, 0 deletions
diff --git a/core/scripts/setup-install.sh b/core/scripts/setup-install.sh new file mode 100644 index 0000000..553aee0 --- /dev/null +++ b/core/scripts/setup-install.sh @@ -0,0 +1,183 @@ +#!/bin/sh + +# First we define the function +ConfirmOrExit () +{ + while true + do + echo -n "Please confirm (y or n) :" + read CONFIRM + case $CONFIRM in + y|Y|YES|yes|Yes) break ;; + n|N|no|NO|No) + echo "Aborting - you entered $CONFIRM" + exit + ;; + *) echo "Please enter only y or n" + esac + done + echo "You entered $CONFIRM. Continuing ..." +} + +# Set Global Vars +DEV=$1 +CHROOT="/mnt" +##read BLK_SWP +BLK_SWP="/dev/sda9" + +##read BLK_EFI +BLK_EFI="${DEV}1" +##read BLK_BOOT +BLK_BOOT="${DEV}2" +##read BLK_ROOT +BLK_ROOT="${DEV}3" +##read BLK_VAR +BLK_VAR="${DEV}4" + +DIR=$(dirname "$PWD"); +DIR_PRT=$(dirname "$DIR")"/c9-ports"; +DIR_CONF=$DIR"/core/conf" + +CRUX_ISO="/boot/crux-3.2.iso" + +echo "Device: $DEV\n" + +echo "1.1.2 EFI block; ($BLK_EFI)" +echo "1.1.2 boot block; ($BLK_BOOT)" +echo "1.1.2 root block; ($BLK_ROOT)" +echo "1.1.2 var block; ($BLK_VAR)" +#echo "1.1.2 swap block; ($BLK_SWP)\n" + +echo "CHROOT=$CHROOT"; +echo "DIR=$DIR"; +echo "DIR_CONF=$DIR_CONF"; +echo "DIR_PRT=$DIR_PRT"; + +echo "CRUX_ISO=$CRUX_ISO"; +ConfirmOrExit + +echo "1.1.2 Creating File System on $BLK_EFI with fat32:" +mkfs.fat -F 32 $BLK_EFI +echo "1.1.2 Creating File System on $BLK_BOOT with ext4:" +mkfs.ext4 $BLK_BOOT +echo "1.1.2 Creating File System on $BLK_ROOT with ext4:" +mkfs.ext4 $BLK_ROOT +echo "1.1.2 Creating File System on $BLK_VAR with ext4:" +mkfs.ext4 $BLK_VAR +#echo "1.1.2 Creating Swap File System on $BLK_SWP:" +#mkswap $BLK_SWP + +echo "1.1.3 mount point to chroot (/mnt):\n" +mount $BLK_ROOT $CHROOT + +mkdir -p $CHROOT/boot +mount $BLK_BOOT $CHROOT/boot +mkdir -p $CHROOT/boot/efi +mount $BLK_EFI $CHROOT/boot/efi +mkdir -p $CHROOT/var +mount $BLK_VAR $CHROOT/var + +mkdir -p $CHROOT/dev +mkdir -p $CHROOT/tmp +mkdir -p $CHROOT/proc +mkdir -p $CHROOT/sys + +mkdir -p $CHROOT/var/lib/pkg +mkdir -p $CHROOT/usr/ports + +mkdir -p $CHROOT/media +mkdir -p $CHROOT/home + +mount --bind /dev $CHROOT/dev +mount -vt devpts devpts $CHROOT/dev/pts +mount -vt tmpfs shm $CHROOT/dev/shm +mount -vt proc proc $CHROOT/proc +mount -vt sysfs sysfs $CHROOT/sys + +mount -o loop $CRUX_ISO $CHROOT/media +#install_crux() { + +echo "1.1.4 Create core.lst and install pkgadd" +for p in $CHROOT/media/crux/core/*; do echo $p >> $CHROOT/core.lst; done + +tar xf "$CHROOT/media/crux/core/pkgutils#5.36-2.pkg.tar.xz" usr/bin/pkgadd -O > $CHROOT/pkgadd + +chmod +x $CHROOT/pkgadd + +echo "1.1.4 File core.lst complete, review list of packages before continue..." +read PAUSE +vim $CHROOT/core.lst + +echo "1.1.4 Starting install" +touch $CHROOT/var/lib/pkg/db + +cd $CHROOT +while read line; do + echo "Installing $line;\n" + $CHROOT/pkgadd -f -r $CHROOT $line +done < core.lst + +rm $CHROOT/pkgadd +rm $CHROOT/core.lst + +echo "1.1.5. Install extra packages;" + +mkdir $CHROOT/usr/ports/packages +cp $CHROOT/media/crux/core/* $CHROOT/usr/ports/packages +cp $CHROOT/media/crux/opt/* $CHROOT/usr/ports/packages +cp $CHROOT/media/crux/xorg/* $CHROOT/usr/ports/packages + +echo "Installing $CHROOT/usr/ports/packages/fakeroot#1.20.2-1.pkg.tar.xz" +$CHROOT/usr/bin/pkgadd -f -r $CHROOT "$CHROOT/usr/ports/packages/fakeroot#1.20.2-1.pkg.tar.xz" +echo "Installing $CHROOT/usr/ports/packages/dbus#1.10.2-1.pkg.tar.xz" +$CHROOT/usr/bin/pkgadd -f -r $CHROOT "$CHROOT/usr/ports/packages/dbus#1.10.2-1.pkg.tar.xz" +echo "Installing $CHROOT/usr/ports/packages/expat#2.1.0-1.pkg.tar.xz" +$CHROOT/usr/bin/pkgadd -f -r $CHROOT "$CHROOT/usr/ports/packages/expat#2.1.0-1.pkg.tar.xz" +echo "Installing $CHROOT/usr/ports/packages/libnl#3.2.27-1.pkg.tar.xz" +$CHROOT/usr/bin/pkgadd -f -r $CHROOT "$CHROOT/usr/ports/packages/libnl#3.2.27-1.pkg.tar.xz" +echo "Installing $CHROOT/usr/ports/packages/libpng#1.6.19-1.pkg.tar.xz" +$CHROOT/usr/bin/pkgadd -f -r $CHROOT "$CHROOT/usr/ports/packages/libpng#1.6.19-1.pkg.tar.xz" +echo "Installing $CHROOT/usr/ports/packages/freetype#2.6.1-1.pkg.tar.xz" +$CHROOT/usr/bin/pkgadd -f -r $CHROOT "$CHROOT/usr/ports/packages/freetype#2.6.1-1.pkg.tar.xz" +echo "Installing $CHROOT/usr/ports/packages/libffi#3.2.1-2.pkg.tar.xz" +$CHROOT/usr/bin/pkgadd -f -r $CHROOT "$CHROOT/usr/ports/packages/libffi#3.2.1-2.pkg.tar.xz" +echo "Installing $CHROOT/usr/ports/packages/sqlite3#3.9.2-1.pkg.tar.xz" +$CHROOT/usr/bin/pkgadd -f -r $CHROOT "$CHROOT/usr/ports/packages/sqlite3#3.9.2-1.pkg.tar.xz" +echo "Installing $CHROOT/usr/ports/packages/python#2.7.10-1.pkg.tar.xz" +$CHROOT/usr/bin/pkgadd -f -r $CHROOT "$CHROOT/usr/ports/packages/python#2.7.10-1.pkg.tar.xz" +echo "Installing $CHROOT/usr/ports/packages/glib#2.46.2-1.pkg.tar.xz" +$CHROOT/usr/bin/pkgadd -f -r $CHROOT "$CHROOT/usr/ports/packages/glib#2.46.2-1.pkg.tar.xz" +echo "Installing $CHROOT/usr/ports/packages/grub2#2.00-7.pkg.tar.xz" +$CHROOT/usr/bin/pkgadd -f -r $CHROOT "$CHROOT/usr/ports/packages/grub2#2.00-7.pkg.tar.xz" +echo "Installing $CHROOT/usr/ports/packages/grub2-efi#2.00-4.pkg.tar.xz" +$CHROOT/usr/bin/pkgadd -f -r $CHROOT "$CHROOT/usr/ports/packages/grub2-efi#2.00-4.pkg.tar.xz" +echo "Installing $CHROOT/usr/ports/packages/wireless-tools#29-1.pkg.tar.xz" +$CHROOT/usr/bin/pkgadd -f -r $CHROOT "$CHROOT/usr/ports/packages/wireless-tools#29-1.pkg.tar.xz" +echo "Installing $CHROOT/usr/ports/packages/wpa_supplicant#2.5-2.pkg.tar.xz" +$CHROOT/usr/bin/pkgadd -f -r $CHROOT "$CHROOT/usr/ports/packages/wpa_supplicant#2.5-2.pkg.tar.xz" +echo "Installing $CHROOT/usr/ports/packages/lvm2#2.02.133-1.pkg.tar.xz" +$CHROOT/usr/bin/pkgadd -f -r $CHROOT "$CHROOT/usr/ports/packages/lvm2#2.02.133-1.pkg.tar.xz" +echo "Installing $CHROOT/usr/ports/packages/mdadm#3.3.4-1.pkg.tar.xz" +$CHROOT/usr/bin/pkgadd -f -r $CHROOT "$CHROOT/usr/ports/packages/mdadm#3.3.4-1.pkg.tar.xz" +echo "Installing $CHROOT/usr/ports/packages/efivar#0.21-1.pkg.tar.xz" +$CHROOT/usr/bin/pkgadd -f -r $CHROOT "$CHROOT/usr/ports/packages/efivar#0.21-1.pkg.tar.xz" +echo "Installing $CHROOT/usr/ports/packages/efibootmgr#0.12-1.pkg.tar.xz" +$CHROOT/usr/bin/pkgadd -f -r $CHROOT "$CHROOT/usr/ports/packages/efibootmgr#0.12-1.pkg.tar.xz" +echo "Installing $CHROOT/usr/ports/packages/dosfstools#3.0.26-1.pkg.tar.xz" +$CHROOT/usr/bin/pkgadd -f -r $CHROOT "$CHROOT/usr/ports/packages/dosfstools#3.0.26-1.pkg.tar.xz" + +echo "1.1.6. Install extra ports;\n" + +mkdir $CHROOT/usr/ports/c9-ports +cp -r $DIR_PRT/* $CHROOT/usr/ports/c9-ports/ + +echo "1.1.7. dns resolver, copy resolv.conf;\n" +cp /etc/resolv.conf $CHROOT/etc + +echo "1.1.8. Install Handbook\n" +cp /media/crux/handbook.txt $CHROOT/root/ + +echo "1.1.9. Install Skeletons\n" +cp -r $DIR_CONF/skel $CHROOT/etc/ +#} +echo "Ready to chroot $CHROOT /bin/bash \n" |