Browse Source

Updated mkimage-arch.sh
* reset umask to 022
* introduced PKGREQUIRED
* introduced PKGREMOVE
- to be able to remove linux etc on Parabola GNU/Linux
* updated PKGIGNORE
- cryptsetup & device-mapper removed to not break the installation
- added not required packages
* force link /etc/localtime
* install pacman-mirrorlist

Signed-off-by: Staf Wagemakers <staf@wagemakers.be>

Staf Wagemakers 6 years ago
parent
commit
74e3edc7d1
1 changed files with 35 additions and 7 deletions
  1. 35 7
      contrib/mkimage-arch.sh

+ 35 - 7
contrib/mkimage-arch.sh

@@ -4,6 +4,9 @@
 # requires root
 # requires root
 set -e
 set -e
 
 
+# reset umask to default
+umask 022
+
 hash pacstrap &>/dev/null || {
 hash pacstrap &>/dev/null || {
 	echo "Could not find pacstrap. Run pacman -S arch-install-scripts"
 	echo "Could not find pacstrap. Run pacman -S arch-install-scripts"
 	exit 1
 	exit 1
@@ -14,20 +17,31 @@ hash expect &>/dev/null || {
 	exit 1
 	exit 1
 }
 }
 
 
-
 export LANG="C.UTF-8"
 export LANG="C.UTF-8"
 
 
 ROOTFS=$(mktemp -d ${TMPDIR:-/var/tmp}/rootfs-archlinux-XXXXXXXXXX)
 ROOTFS=$(mktemp -d ${TMPDIR:-/var/tmp}/rootfs-archlinux-XXXXXXXXXX)
 chmod 755 $ROOTFS
 chmod 755 $ROOTFS
 
 
+# required packages
+PKGREQUIRED=(
+    bash
+    haveged
+    pacman
+    pacman-mirrorlist
+)
+
 # packages to ignore for space savings
 # packages to ignore for space savings
 PKGIGNORE=(
 PKGIGNORE=(
-    cryptsetup
-    device-mapper
     dhcpcd
     dhcpcd
+    diffutils
+    file
+    inetutils
     iproute2
     iproute2
+    iputils
     jfsutils
     jfsutils
+    licenses
     linux
     linux
+    linux-firmware
     lvm2
     lvm2
     man-db
     man-db
     man-pages
     man-pages
@@ -37,16 +51,30 @@ PKGIGNORE=(
     openresolv
     openresolv
     pciutils
     pciutils
     pcmciautils
     pcmciautils
+    psmisc
     reiserfsprogs
     reiserfsprogs
     s-nail
     s-nail
+    sysfsutils
     systemd-sysvcompat
     systemd-sysvcompat
     usbutils
     usbutils
     vi
     vi
+    which
     xfsprogs
     xfsprogs
 )
 )
+
+PKGREMOVE=(
+    gawk
+    haveged 
+    less
+    linux-libre
+    linux-libre-firmware
+)
+
+PKGREQUIRED="${PKGREQUIRED[*]}"
 IFS=','
 IFS=','
 PKGIGNORE="${PKGIGNORE[*]}"
 PKGIGNORE="${PKGIGNORE[*]}"
 unset IFS
 unset IFS
+PKGREMOVE="${PKGREMOVE[*]}"
 
 
 arch="$(uname -m)"
 arch="$(uname -m)"
 case "$arch" in
 case "$arch" in
@@ -87,7 +115,7 @@ expect <<EOF
 	}
 	}
 	set timeout $EXPECT_TIMEOUT
 	set timeout $EXPECT_TIMEOUT
 
 
-	spawn pacstrap -C $PACMAN_CONF -c -d -G -i $ROOTFS base haveged $PACMAN_EXTRA_PKGS --ignore $PKGIGNORE
+  spawn pacstrap -C $PACMAN_CONF -c -d -G -i $ROOTFS base $PKGREQUIRED $PACMAN_EXTRA_PKGS --ignore $PKGIGNORE
 	expect {
 	expect {
 		-exact "anyway? \[Y/n\] " { send -- "n\r"; exp_continue }
 		-exact "anyway? \[Y/n\] " { send -- "n\r"; exp_continue }
 		-exact "(default=all): " { send -- "\r"; exp_continue }
 		-exact "(default=all): " { send -- "\r"; exp_continue }
@@ -97,11 +125,11 @@ expect <<EOF
 EOF
 EOF
 
 
 arch-chroot $ROOTFS /bin/sh -c 'rm -r /usr/share/man/*'
 arch-chroot $ROOTFS /bin/sh -c 'rm -r /usr/share/man/*'
-arch-chroot $ROOTFS /bin/sh -c "haveged -w 1024; pacman-key --init; pkill haveged; pacman -Rs --noconfirm haveged; pacman-key --populate $ARCH_KEYRING; pkill gpg-agent"
-arch-chroot $ROOTFS /bin/sh -c "ln -s /usr/share/zoneinfo/UTC /etc/localtime"
+arch-chroot $ROOTFS /bin/sh -c "haveged -w 1024; pacman-key --init; pkill haveged; pacman-key --populate $ARCH_KEYRING"
+arch-chroot $ROOTFS /bin/sh -c "ln -sf /usr/share/zoneinfo/UTC /etc/localtime"
+arch-chroot $ROOTFS /bin/sh -c "for pkg in $PKGREMOVE; do if pacman -Qi \$pkg > /dev/null 2>&1; then pacman -Rs --noconfirm \$pkg; fi; done"
 echo 'en_US.UTF-8 UTF-8' > $ROOTFS/etc/locale.gen
 echo 'en_US.UTF-8 UTF-8' > $ROOTFS/etc/locale.gen
 arch-chroot $ROOTFS locale-gen
 arch-chroot $ROOTFS locale-gen
-arch-chroot $ROOTFS /bin/sh -c 'echo $PACMAN_MIRRORLIST > /etc/pacman.d/mirrorlist'
 
 
 # udev doesn't work in containers, rebuild /dev
 # udev doesn't work in containers, rebuild /dev
 DEV=$ROOTFS/dev
 DEV=$ROOTFS/dev