Fixed inittab, with some alpine-chroot fixes

This commit is contained in:
Antoine Martin 2023-08-25 23:00:57 -04:00
parent c97f16d5ba
commit b4fb6ea066
Signed by: forge
GPG key ID: D62A472A4AA7D541
4 changed files with 24 additions and 15 deletions

View file

@ -24,8 +24,6 @@ PKGGROUPS="$(sed '/^ *#/d; s/ *#.*//' "${PKGLISTFILE}" | sed ':a;N;$!ba; s/\n/
APKTOOLS_CACHE_DIR="${CACHE_DIR}/apk_cache"
export APKTOOLS_CACHE_DIR
ln -sf ../../var/cache/apk $INSTALLDIR/etc/apk/cache
echo " --> Enabling main and community repos..."
su -c "echo 'https://dl-cdn.alpinelinux.org/alpine/v3.18/main' > $INSTALLDIR/etc/apk/repositories"
su -c "echo 'https://dl-cdn.alpinelinux.org/alpine/v3.18/community' >> $INSTALLDIR/etc/apk/repositories"

View file

@ -4,8 +4,7 @@
echo "--> Alpine linux 04_install_qubes.sh"
APKTOOLS_CACHE_DIR="${CACHEDIR}/apk_cache"
APK_CUSTOM_REPO_DIR="${PWD}/pkgs-for-template/${DIST}"
export APK_CACHE_DIR APK_CUSTOM_REPO_DIR "ALL_PROXY=$REPO_PROXY"
export APK_CACHE_DIR
set -e
if [ "$VERBOSE" -ge 2 ] || [ "$DEBUG" -gt 0 ]; then
@ -20,15 +19,15 @@ echo " --> Synchronize resolv.conf..."
cp /etc/resolv.conf "${INSTALLDIR}/etc/resolv.conf"
echo " --> Updating apk repos..."
"${SCRIPTSDIR}/alpine-chroot" "$INSTALLDIR" /bin/sh -c \
"${TEMPLATE_CONTENT_DIR}/alpine-chroot" "$INSTALLDIR" /bin/sh -c \
"apk update; apk upgrade"
echo " --> Installing mandatory qubes packages..."
"${SCRIPTSDIR}/alpine-chroot" "$INSTALLDIR" /bin/sh -c \
"${TEMPLATE_CONTENT_DIR}/alpine-chroot" "$INSTALLDIR" /bin/sh -c \
"apk add qubes-vm-dependencies"
echo " --> Installing recommended qubes apps"
"${SCRIPTSDIR}/alpine-chroot" "$INSTALLDIR" /bin/sh -c \
"${TEMPLATE_CONTENT_DIR}/alpine-chroot" "$INSTALLDIR" /bin/sh -c \
"apk add qubes-vm-recommended"
echo " --> Updating template fstab file..."
@ -53,10 +52,16 @@ EOF
echo " --> Configuring system to our preferences..."
# add hcv0 to inittab
echo "hvc0::respawn:/sbin/getty -L hvc0 115200 vt220" >> "$INSTALLDIR"/etc/inittap
echo "hvc0::respawn:/sbin/getty -L hvc0 115200 vt220" >> "$INSTALLDIR"/etc/inittab
# add group qubes and user
"${TEMPLATE_CONTENT_DIR}/alpine-chroot" "$INSTALLDIR" addgroup user
"${TEMPLATE_CONTENT_DIR}/alpine-chroot" "$INSTALLDIR" addgroup qubes
# add user:user
"${SCRIPTSDIR}/alpine-chroot" "$INSTALLDIR" adduser -D -S user
"${TEMPLATE_CONTENT_DIR}/alpine-chroot" "$INSTALLDIR" adduser -D -S user -g qubes -G user
# enable services
for i in udev udev-trigger xendriverdomain qubes-qrexec-agent qubes-db qubes-meminfo-writer qubes-sysinit qubes-core-early qubes-core qubes-gui-agent; do
"${SCRIPTSDIR}/alpine-chroot" "$INSTALLDIR" rc-update add $i
for i in udev udev-trigger xendriverdomain qubes-qrexec-agent qubes-db qubes-meminfo-writer qubes-sysinit qubes-core-early qubes-core crond acpid; do
"${TEMPLATE_CONTENT_DIR}/alpine-chroot" "$INSTALLDIR" rc-update add $i default
done
# setup initramfs

View file

@ -37,16 +37,15 @@ chroot_setup() {
chroot_add_mount run "$1/run" -t tmpfs -o nosuid,nodev,mode=0755 &&
chroot_add_mount tmp "$1/tmp" -t tmpfs -o mode=1777,strictatime,nodev,nosuid ||
exit
if [[ -d "$APKTOOLS_CACHE_DIR" ]]; then
APKTOOLS_CACHE_MOUNT_DIR="${APKTOOLS_CACHE_MOUNT_DIR:-$1/var/cache/apk}"
APKTOOLS_CACHE_MOUNT_DIR="${APKTOOLS_CACHE_MOUNT_DIR:-$1/etc/apk/cache}"
mkdir -p "$APKTOOLS_CACHE_MOUNT_DIR"
# Cached qubes packages may be from old runs and throw checksum errors
chroot_add_mount "$APKTOOLS_CACHE_DIR" "$APKTOOLS_CACHE_MOUNT_DIR" --bind
chroot_add_mount "$APKTOOLS_CACHE_DIR" "$APKTOOLS_CACHE_MOUNT_DIR" -o bind
fi
if [[ -d "$APKTOOLS_CUSTOM_REPO_DIR" ]]; then
mkdir -p "$1/tmp/qubes-packages-mirror-repo"
chroot_add_mount "$APKTOOLS_CUSTOM_REPO_DIR" "$1/tmp/qubes-packages-mirror-repo" --bind
chroot_add_mount "$APKTOOLS_CUSTOM_REPO_DIR" "$1/tmp/qubes-packages-mirror-repo" -o bind
fi
}

View file

@ -17,6 +17,13 @@ openssh
grep
htop
# should be depends by core
e2fsprogs
e2fsprogs-extra
blkid
mkinitfs
grub-bios
# User env
ldns
tmux