about summary refs log tree commit diff stats
path: root/core
diff options
context:
space:
mode:
authorSilvino Silva <silvino@bk.ru>2020-04-20 00:59:01 +0100
committerSilvino Silva <silvino@bk.ru>2020-04-20 00:59:01 +0100
commitfd186246f96768b8398f0ffe32ef136cb895fa21 (patch)
tree8730a3f64e215dcb838841f0e905c18f39d21f36 /core
parent0791543e4c3a97fabfa2ff5bea2caae500bd19d4 (diff)
downloaddoc-fd186246f96768b8398f0ffe32ef136cb895fa21.tar.gz
fix install-core.sh script
Diffstat (limited to 'core')
-rw-r--r--core/scripts/install-core.sh180
1 files changed, 112 insertions, 68 deletions
diff --git a/core/scripts/install-core.sh b/core/scripts/install-core.sh
index 9edd966..7c3f094 100644
--- a/core/scripts/install-core.sh
+++ b/core/scripts/install-core.sh
@@ -2,6 +2,7 @@
 
 CHROOT="/mnt"
 PORT_PKG="${CHROOT}/media/crux"
+INSTALL_OPT=0
 
 #echo "1.1.8. Install Handbook\n"
 #cp ${PORT_PKG}/handbook.txt $CHROOT/root/
@@ -41,11 +42,12 @@ install_core() {
         done
     fi
 
-    tar xf "${PORT_PKG}/core/pkgutils#5.40-7.pkg.tar.xz" usr/bin/pkgadd -O > ${CHROOT}/pkgadd
-
+    # it is required a degree in astrophysics in order to figure out how to extract a file to a target folder
+    bsdtar -C ${CHROOT} -xf "${PORT_PKG}/core/pkgutils#5.40.7-1.pkg.tar.xz" usr/bin/pkgadd
+    mv ${CHROOT}/usr/bin/pkgadd ${CHROOT}
     chmod +x ${CHROOT}/pkgadd
 
-    echo "1.1.4 File core.pkg complete, review list of packages before continue..."
+    echo "1.1.4 File core.pkg complete, review list of packages before continue... [PRESS ENTER]"
     read PAUSE
     vim ${CORE_LS}
 
@@ -54,9 +56,9 @@ install_core() {
     #cd $CHROOT
     while read line; do
         pkg=${PORT_PKG}/core/${line}
-        echo "Installing ${pkg};\n"
+        echo "Installing ${pkg}"
         #${CHROOT}/pkgadd -f -r ${CHROOT} ${pkg}
-        pkgadd -f -r ${CHROOT} ${pkg}
+        ${CHROOT}/pkgadd -f -r ${CHROOT} ${pkg}
     done < ${CORE_LS}
 
     rm ${CHROOT}/pkgadd
@@ -67,71 +69,113 @@ install_core() {
 }
 
 install_packages() {
-    echo "Installing $CHROOT/media/crux/opt/fakeroot"
-    $CHROOT/usr/bin/pkgadd -f -r $CHROOT ${CHROOT}/media/crux/opt/fakeroot#*
-    echo "Installing $CHROOT/media/crux/opt/dbus"
-    $CHROOT/usr/bin/pkgadd -f -r $CHROOT $CHROOT/media/crux/opt/dbus#*
-    echo "Installing $CHROOT/media/crux/opt/expat"
-    $CHROOT/usr/bin/pkgadd -f -r $CHROOT $CHROOT/media/crux/opt/expat#*
-    echo "Installing $CHROOT/media/crux/opt/libnl"
-    $CHROOT/usr/bin/pkgadd -f -r $CHROOT $CHROOT/media/crux/opt/libnl#*
-    echo "Installing $CHROOT/media/crux/opt/libpng"
-    $CHROOT/usr/bin/pkgadd -f -r $CHROOT $CHROOT/media/crux/opt/libpng#*
-    echo "Installing $CHROOT/media/crux/opt/freetype"
-    $CHROOT/usr/bin/pkgadd -f -r $CHROOT $CHROOT/media/crux/opt/freetype#*
-    echo "Installing $CHROOT/media/crux/opt/libffi"
-    $CHROOT/usr/bin/pkgadd -f -r $CHROOT $CHROOT/media/crux/opt/libffi#*
-    echo "Installing $CHROOT/media/crux/opt/sqlite3"
-    $CHROOT/usr/bin/pkgadd -f -r $CHROOT $CHROOT/media/crux/opt/sqlite3#*
-    echo "Installing $CHROOT/media/crux/opt/python"
-    $CHROOT/usr/bin/pkgadd -f -r $CHROOT $CHROOT/media/crux/opt/python#*
-    echo "Installing $CHROOT/media/crux/opt/glib"
-    $CHROOT/usr/bin/pkgadd -f -r $CHROOT $CHROOT/media/crux/opt/glib#*
-    echo "Installing $CHROOT/media/crux/opt/grub2"
-    $CHROOT/usr/bin/pkgadd -f -r $CHROOT $CHROOT/media/crux/opt/grub2#*
-    echo "Installing $CHROOT/media/crux/opt/grub2-efi"
-    $CHROOT/usr/bin/pkgadd -f -r $CHROOT $CHROOT/media/crux/opt/grub2-efi#*
-    echo "Installing $CHROOT/media/crux/opt/wireless-tools"
-    $CHROOT/usr/bin/pkgadd -f -r $CHROOT $CHROOT/media/crux/opt/wireless-tools#*
-    echo "Installing $CHROOT/media/crux/opt/wpa_supplicant"
-    $CHROOT/usr/bin/pkgadd -f -r $CHROOT $CHROOT/media/crux/opt/wpa_supplicant#*
-    echo "Installing $CHROOT/media/crux/opt/lvm2"
-    $CHROOT/usr/bin/pkgadd -f -r $CHROOT $CHROOT/media/crux/opt/lvm2#*
-    echo "Installing $CHROOT/media/crux/opt/mdadm"
-    $CHROOT/usr/bin/pkgadd -f -r $CHROOT $CHROOT/media/crux/opt/mdadm#*
-    echo "Installing $CHROOT/media/crux/opt/efivar"
-    $CHROOT/usr/bin/pkgadd -f -r $CHROOT $CHROOT/media/crux/opt/efivar#*
-    echo "Installing $CHROOT/media/crux/opt/efibootmgr"
-    $CHROOT/usr/bin/pkgadd -f -r $CHROOT $CHROOT/media/crux/opt/efibootmgr#*
-    echo "Installing $CHROOT/media/crux/opt/dosfstools"
-    $CHROOT/usr/bin/pkgadd -f -r $CHROOT $CHROOT/media/crux/opt/dosfstools#*
-    echo "Installing $CHROOT/media/crux/opt/parted"
-    $CHROOT/usr/bin/pkgadd -f -r $CHROOT $CHROOT/media/crux/opt/parted#*
-    echo "Installing $CHROOT/media/crux/opt/libgcrypt"
-    $CHROOT/usr/bin/pkgadd -f -r $CHROOT $CHROOT/media/crux/opt/libgcrypt#*
-    echo "Installing $CHROOT/media/crux/opt/cryptsetup"
-    $CHROOT/usr/bin/pkgadd -f -r $CHROOT $CHROOT/media/crux/opt/cryptsetup#*
-    echo "Installing $CHROOT/media/crux/opt/popt"
-    $CHROOT/usr/bin/pkgadd -f -r $CHROOT $CHROOT/media/crux/opt/popt#*
-    echo "Installing $CHROOT/media/crux/opt/libgpg-error"
-    $CHROOT/usr/bin/pkgadd -f -r $CHROOT $CHROOT/media/crux/opt/libgpg-error#*
-    echo "Installing $CHROOT/media/crux/opt/libevent"
-    $CHROOT/usr/bin/pkgadd -f -r $CHROOT $CHROOT/media/crux/opt/libevent#*
-    echo "Installing $CHROOT/media/crux/opt/libtirpc"
-    $CHROOT/usr/bin/pkgadd -f -r $CHROOT $CHROOT/media/crux/opt/libtirpc#*
-    echo "Installing $CHROOT/media/crux/opt/git"
-    $CHROOT/usr/bin/pkgadd -f -r $CHROOT $CHROOT/media/crux/opt/git#*
-    echo "Installing $CHROOT/media/crux/opt/tmux"
-    $CHROOT/usr/bin/pkgadd -f -r $CHROOT $CHROOT/media/crux/opt/tmux#*
-    echo "Installing $CHROOT/media/crux/opt/prt-utils"
-    $CHROOT/usr/bin/pkgadd -f -r $CHROOT $CHROOT/media/crux/opt/prt-utils#*
-    echo "Installing $CHROOT/media/crux/opt/elfutils"
-    $CHROOT/usr/bin/pkgadd -f -r $CHROOT $CHROOT/media/crux/opt/elfutils#*
+    echo "Installing ${PORT_PKG}/opt/fakeroot"
+    $CHROOT/usr/bin/pkgadd -f -r $CHROOT ${PORT_PKG}/opt/fakeroot#*
+    echo "Installing ${PORT_PKG}/opt/dbus"
+    $CHROOT/usr/bin/pkgadd -f -r $CHROOT ${PORT_PKG}/opt/dbus#*
+    echo "Installing ${PORT_PKG}/opt/expat"
+    $CHROOT/usr/bin/pkgadd -f -r $CHROOT ${PORT_PKG}/opt/expat#*
+    echo "Installing ${PORT_PKG}/opt/libnl"
+    $CHROOT/usr/bin/pkgadd -f -r $CHROOT ${PORT_PKG}/opt/libnl#*
+    echo "Installing ${PORT_PKG}/opt/libpng"
+    $CHROOT/usr/bin/pkgadd -f -r $CHROOT ${PORT_PKG}/opt/libpng#*
+    echo "Installing ${PORT_PKG}/opt/freetype"
+    $CHROOT/usr/bin/pkgadd -f -r $CHROOT ${PORT_PKG}/opt/freetype#*
+    echo "Installing ${PORT_PKG}/opt/libffi"
+    $CHROOT/usr/bin/pkgadd -f -r $CHROOT ${PORT_PKG}/opt/libffi#*
+    echo "Installing ${PORT_PKG}/opt/sqlite3"
+    $CHROOT/usr/bin/pkgadd -f -r $CHROOT ${PORT_PKG}/opt/sqlite3#*
+    echo "Installing ${PORT_PKG}/opt/python"
+    $CHROOT/usr/bin/pkgadd -f -r $CHROOT ${PORT_PKG}/opt/python#*
+    echo "Installing ${PORT_PKG}/opt/glib"
+    $CHROOT/usr/bin/pkgadd -f -r $CHROOT ${PORT_PKG}/opt/glib#*
+    echo "Installing ${PORT_PKG}/opt/grub2"
+    $CHROOT/usr/bin/pkgadd -f -r $CHROOT ${PORT_PKG}/opt/grub2#*
+    echo "Installing ${PORT_PKG}/opt/grub2-efi"
+    $CHROOT/usr/bin/pkgadd -f -r $CHROOT ${PORT_PKG}/opt/grub2-efi#*
+    echo "Installing ${PORT_PKG}/opt/wireless-tools"
+    $CHROOT/usr/bin/pkgadd -f -r $CHROOT ${PORT_PKG}/opt/wireless-tools#*
+    echo "Installing ${PORT_PKG}/opt/wpa_supplicant"
+    $CHROOT/usr/bin/pkgadd -f -r $CHROOT ${PORT_PKG}/opt/wpa_supplicant#*
+    echo "Installing ${PORT_PKG}/opt/lvm2"
+    $CHROOT/usr/bin/pkgadd -f -r $CHROOT ${PORT_PKG}/opt/lvm2#*
+    echo "Installing ${PORT_PKG}/opt/mdadm"
+    $CHROOT/usr/bin/pkgadd -f -r $CHROOT ${PORT_PKG}/opt/mdadm#*
+    echo "Installing ${PORT_PKG}/opt/efivar"
+    $CHROOT/usr/bin/pkgadd -f -r $CHROOT ${PORT_PKG}/opt/efivar#*
+    echo "Installing ${PORT_PKG}/opt/efibootmgr"
+    $CHROOT/usr/bin/pkgadd -f -r $CHROOT ${PORT_PKG}/opt/efibootmgr#*
+    echo "Installing ${PORT_PKG}/opt/dosfstools"
+    $CHROOT/usr/bin/pkgadd -f -r $CHROOT ${PORT_PKG}/opt/dosfstools#*
+    echo "Installing ${PORT_PKG}/opt/parted"
+    $CHROOT/usr/bin/pkgadd -f -r $CHROOT ${PORT_PKG}/opt/parted#*
+    echo "Installing ${PORT_PKG}/opt/libgcrypt"
+    $CHROOT/usr/bin/pkgadd -f -r $CHROOT ${PORT_PKG}/opt/libgcrypt#*
+    echo "Installing ${PORT_PKG}/opt/cryptsetup"
+    $CHROOT/usr/bin/pkgadd -f -r $CHROOT ${PORT_PKG}/opt/cryptsetup#*
+    echo "Installing ${PORT_PKG}/opt/popt"
+    $CHROOT/usr/bin/pkgadd -f -r $CHROOT ${PORT_PKG}/opt/popt#*
+    echo "Installing ${PORT_PKG}/opt/libgpg-error"
+    $CHROOT/usr/bin/pkgadd -f -r $CHROOT ${PORT_PKG}/opt/libgpg-error#*
+    echo "Installing ${PORT_PKG}/opt/libevent"
+    $CHROOT/usr/bin/pkgadd -f -r $CHROOT ${PORT_PKG}/opt/libevent#*
+    echo "Installing ${PORT_PKG}/opt/libtirpc"
+    $CHROOT/usr/bin/pkgadd -f -r $CHROOT ${PORT_PKG}/opt/libtirpc#*
+    echo "Installing ${PORT_PKG}/opt/git"
+    $CHROOT/usr/bin/pkgadd -f -r $CHROOT ${PORT_PKG}/opt/git#*
+    echo "Installing ${PORT_PKG}/opt/tmux"
+    $CHROOT/usr/bin/pkgadd -f -r $CHROOT ${PORT_PKG}/opt/tmux#*
+    echo "Installing ${PORT_PKG}/opt/prt-utils"
+    $CHROOT/usr/bin/pkgadd -f -r $CHROOT ${PORT_PKG}/opt/prt-utils#*
+    echo "Installing ${PORT_PKG}/opt/elfutils"
+    $CHROOT/usr/bin/pkgadd -f -r $CHROOT ${PORT_PKG}/opt/elfutils#*
 }
 
-echo "PORT_PKG=${PORT_PKG}";
-echo "CHROOT=$CHROOT";
+print_data() {
+    echo "1.1.4 Paths to packages and target:"
+    echo "chroot: ${CHROOT}"
+    echo "packages dir: ${PORT_PKG}"
+    echo "install optional: ${INSTALL_OPT}"
+}
 
+print_help() {
+	echo "usage: install-core [options]"
+	echo "options:"
+	echo "  -r,   --chroot              default chroot is /mnt"
+	echo "  -p,   --packages            packages directory /mnt/media/crux"
+	echo "  -o,   --optional            install extra packages"
+	echo "  -h,   --help                print help and exit"
+}
+
+while [ "$1" ]; do
+            case $1 in
+                    -r|--chroot)
+                        CHROOT=$2
+                        shift ;;
+                    -p|--packages)
+                        PORT_PKG=$2
+                        shift ;;
+                    -o|--optional)
+                        INSTALL_OPT=1
+                        ;;
+                    -h|--help)
+                        print_help
+                        exit 0 ;;
+                    *)
+                        echo "setup-iso: invalid option $1"
+                        print_help
+                        exit 1 ;;
+            esac
+            shift
+done
+
+print_data
 ConfirmOrExit
 install_core
-install_packages
+echo "=========[ core installed ]==========="
+
+if [[ $INSTALL_OPT -eq 1 ]];
+then
+    install_packages
+    echo "=========[ extra packages installed ]==========="
+fi