about summary refs log blame commit diff stats
path: root/core/scripts/install.sh
blob: 495b3272d546c8ba3f88df8809d463dd2f404239 (plain) (tree)
























































































































































































                                                                                                         
#!/bin/bash
# Set Global Vars

DIR=$(dirname "$PWD");
DIR_PRT=$(dirname "$DIR")"/c9-ports";
DIR_CONF=$DIR"/conf"

printf "CHROOT="$CHROOT"\n";
printf "DIR="$DIR"\n";
printf "DIR_CONF="$DIR_CONF"\n";
printf "DIR_PRT="$DIR_PRT"\n";
read PAUSE

printf "1.1.2 EFI block; (/dev/sda1):\n"
#read BLK_EFI
BLK_EFI="/dev/sda1"

printf "1.1.2 boot block; (/dev/sda2):\n"
#read BLK_BOOT
BLK_BOOT="/dev/sda2"

printf "1.1.2 root block; (/dev/sda3):\n"
#read BLK_ROOT
BLK_ROOT="/dev/sda3"
#
printf "1.1.2 var block; (/dev/sda4):\n"
#read BLK_VAR
BLK_VAR="/dev/sda4"
#
printf "1.1.2 usr block; (/dev/sda6):\n"
#read BLK_USR
BLK_USR="/dev/sda6"
#
printf "1.1.2 home block; (/dev/sda7):\n"
#read BLK_HOME
BLK_HOME="/dev/sda7"
#
printf "1.1.2 ports block; (/dev/sda8):\n"
#read BLK_PRT
BLK_PRT="/dev/sda8"

printf "1.1.2 swap block; (/dev/sda9):\n"
#read BLK_SWP
BLK_SWP="/dev/sda9"

printf "1.1.3 mount point to chroot (/mnt):\n"
#read CHROOT
CHROOT="/mnt"

#manual_install() {

    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 File System on $BLK_USR with ext4:"
    mkfs.ext4 $BLK_USR
    echo "1.1.2 Creating File System on $BLK_HOME with ext4:"
    mkfs.ext4 $BLK_HOME
#    echo "1.1.2 Creating File System on $BLK_PRT with ext4:"
#    mkfs.ext4 $BLK_PRT
    echo "1.1.2 Creating Swap File System on $BLK_SWP:"
    #mkswap $BLK_SWP

#}


#prepare_target(){

    printf "1.1.3 mount point to chroot (/mnt):\n"
    mount $BLK_ROOT $CHROOT

    mkdir -p $CHROOT/boot
    mkdir -p $CHROOT/var
    mkdir -p $CHROOT/usr
    mkdir -p $CHROOT/media
    mkdir -p $CHROOT/home

    mkdir -p $CHROOT/dev
    mkdir -p $CHROOT/tmp
    mkdir -p $CHROOT/proc
    mkdir -p $CHROOT/sys

    mount $BLK_BOOT $CHROOT/boot
    mkdir -p $CHROOT/boot/efi
    mount $BLK_EFI $CHROOT/boot/efi

    mount $BLK_VAR $CHROOT/var
    mkdir -p $CHROOT/var/lib/pkg

    mount $BLK_USR $CHROOT/usr
    mkdir -p $CHROOT/usr/ports
#    mount $BLK_PRT $CHROOT/usr/ports
    mount $BLK_HOME $CHROOT/home

#install_crux() {

    echo "1.1.4 Create core.lst and install pkgadd"
    for p in /media/crux/core/*; do echo $p >> $CHROOT/core.lst; done

    tar xf "/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
        printf "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 /media/crux/core/* $CHROOT/usr/ports/packages
	cp /media/crux/opt/* $CHROOT/usr/ports/packages
	cp /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/
#}
printf "Ready to chroot $CHROOT /bin/bash \n"