From 770293e2d890921b8731c105d3fde9f9557a2f5c Mon Sep 17 00:00:00 2001 From: r00t Date: Sun, 20 Nov 2016 02:23:18 -0500 Subject: [PATCH] and more cleanup for some pkg lists etc. --- .../i686/root/packages.arch} | 0 .../root/prereqs/iso.pkgs.arch} | 0 .../root/{prereqs => }/iso.pkgs.both | 0 extra/{ => pre-build.d/root}/packages.both | 0 extra/pre-build.d/root/post-build.sh | 8 --- extra/pre-build.d/root/pre-build.sh | 52 ++++++++++++++++++- .../x86_64/root/packages.arch} | 0 .../root/prereqs/iso.pkgs.arch} | 0 8 files changed, 50 insertions(+), 10 deletions(-) rename extra/{packages.i686 => pre-build.d/i686/root/packages.arch} (100%) rename extra/pre-build.d/{root/prereqs/iso.pkgs.i686 => i686/root/prereqs/iso.pkgs.arch} (100%) rename extra/pre-build.d/root/{prereqs => }/iso.pkgs.both (100%) rename extra/{ => pre-build.d/root}/packages.both (100%) delete mode 100755 extra/pre-build.d/root/post-build.sh rename extra/{packages.x86_64 => pre-build.d/x86_64/root/packages.arch} (100%) rename extra/pre-build.d/{root/prereqs/iso.pkgs.x86_64 => x86_64/root/prereqs/iso.pkgs.arch} (100%) diff --git a/extra/packages.i686 b/extra/pre-build.d/i686/root/packages.arch similarity index 100% rename from extra/packages.i686 rename to extra/pre-build.d/i686/root/packages.arch diff --git a/extra/pre-build.d/root/prereqs/iso.pkgs.i686 b/extra/pre-build.d/i686/root/prereqs/iso.pkgs.arch similarity index 100% rename from extra/pre-build.d/root/prereqs/iso.pkgs.i686 rename to extra/pre-build.d/i686/root/prereqs/iso.pkgs.arch diff --git a/extra/pre-build.d/root/prereqs/iso.pkgs.both b/extra/pre-build.d/root/iso.pkgs.both similarity index 100% rename from extra/pre-build.d/root/prereqs/iso.pkgs.both rename to extra/pre-build.d/root/iso.pkgs.both diff --git a/extra/packages.both b/extra/pre-build.d/root/packages.both similarity index 100% rename from extra/packages.both rename to extra/pre-build.d/root/packages.both diff --git a/extra/pre-build.d/root/post-build.sh b/extra/pre-build.d/root/post-build.sh deleted file mode 100755 index 112967f..0000000 --- a/extra/pre-build.d/root/post-build.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash - -set -e - -apacman --noconfirm --noedit -S --needed customizepkg-scripting -ln -s /usr/lib/libdialog.so.1.2 /usr/lib/libdialog.so - -echo "Done." diff --git a/extra/pre-build.d/root/pre-build.sh b/extra/pre-build.d/root/pre-build.sh index 62b9bc4..6612445 100755 --- a/extra/pre-build.d/root/pre-build.sh +++ b/extra/pre-build.d/root/pre-build.sh @@ -71,7 +71,7 @@ else TGT_ARCH='i686' fi # Install some stuff we need for the ISO. -PKGLIST=$(sed -e '/^[[:space:]]*#/d ; /^[[:space:]]*$/d' /root/prereqs/iso.pkgs.both | tr '\n' ' ') +PKGLIST=$(sed -e '/^[[:space:]]*#/d ; /^[[:space:]]*$/d' /root/iso.pkgs.both | tr '\n' ' ') if [[ -n "${PKGLIST}" ]]; then apacman --noconfirm --noedit --skipinteg -S --needed ${PKGLIST} @@ -79,13 +79,23 @@ then cleanPacorigs fi # And install arch-specific packages for the ISO, if there are any. -PKGLIST=$(sed -e '/^[[:space:]]*#/d ; /^[[:space:]]*$/d' /root/prereqs/iso.pkgs.${TGT_ARCH} | tr '\n' ' ') +PKGLIST=$(sed -e '/^[[:space:]]*#/d ; /^[[:space:]]*$/d' /root/iso.pkgs.arch | tr '\n' ' ') if [[ -n "${PKGLIST}" ]]; then apacman --noconfirm --noedit --skipinteg -S --needed ${PKGLIST} apacman --gendb cleanPacorigs fi +# Do some post tasks before continuing +apacman --noconfirm --noedit -S --needed customizepkg-scripting +ln -s /usr/lib/libdialog.so.1.2 /usr/lib/libdialog.so +cleanPacorigs +apacman --noconfirm --noedit --skipinteg -S --needed linux +apacman --gendb +cp -a /boot/vmlinuz-linux /boot/vmlinuz-linux-${DISTNAME} +cp -af /boot/initramfs-linux.img /boot/initramfs-linux-${DISTNAME}.img +cleanPacorigs + # And install EXTRA functionality packages, if there are any. PKGLIST=$(sed -e '/^[[:space:]]*#/d ; /^[[:space:]]*$/d' /root/packages.both | tr '\n' ' ') if [[ -n "${PKGLIST}" ]]; @@ -94,3 +104,41 @@ then apacman --gendb cleanPacorigs fi +# Add the regular user +useradd -m -s /bin/bash -c "Default user" ${REGUSR} +usermod -aG users,games,video,audio ${REGUSR} +passwd -d ${REGUSR} +# Add them to sudoers +mkdir -p /etc/sudoers.d +chmod 750 /etc/sudoers.d +printf "Defaults:${REGUSR} \041lecture\n${REGUSR} ALL=(ALL) ALL\n" >> /etc/sudoers.d/${REGUSR} +# Set the password, if we need to. +if [[ -n "${REGUSR_PASS}" && "${REGUSR_PASS}" != 'BLANK' ]]; + then + sed -i -e "s|^${REGUSR}::|${REGUSR}:${REGUSR_PASS}:|g" /etc/shadow +elif [[ "${REGUSR_PASS}" == '{[BLANK]}' ]]; +then + passwd -d ${REGUSR} +else + usermod -L ${REGUSR} +fi +# Set the root password, if we need to. +if [[ -n "${ROOT_PASS}" && "${ROOT_PASS}" != 'BLANK' ]]; +then + sed -i -e "s|^root::|root:${ROOT_PASS}:|g" /etc/shadow +elif [[ "${ROOT_PASS}" == 'BLANK' ]]; +then + passwd -d root +else + usermod -L root +fi +cleanPacorigs +cp -af /boot/initramfs-linux.img /boot/initramfs-linux-${DISTNAME}.img +# And install arch-specific extra packages, if there are any. +PKGLIST=$(sed -e '/^[[:space:]]*#/d ; /^[[:space:]]*$/d' /root/packages.arch | tr '\n' ' ') +if [[ -n "${PKGLIST}" ]]; +then + apacman --noconfirm --noedit --skipinteg -S --needed ${PKGLIST} + apacman --gendb + cleanPacorigs +fi diff --git a/extra/packages.x86_64 b/extra/pre-build.d/x86_64/root/packages.arch similarity index 100% rename from extra/packages.x86_64 rename to extra/pre-build.d/x86_64/root/packages.arch diff --git a/extra/pre-build.d/root/prereqs/iso.pkgs.x86_64 b/extra/pre-build.d/x86_64/root/prereqs/iso.pkgs.arch similarity index 100% rename from extra/pre-build.d/root/prereqs/iso.pkgs.x86_64 rename to extra/pre-build.d/x86_64/root/prereqs/iso.pkgs.arch