From 23c608198b58a6590519cc4d67672f745e466029 Mon Sep 17 00:00:00 2001 From: Logan Gartner Date: Wed, 12 Aug 2020 15:08:19 -0600 Subject: [PATCH] Reorganized utilities, fixed stupid typo, timestamp now uses start Timestamps in the build now grab the time at the beginning of the build, instead of the end Sudoers file didn't use chroot path Rearranged octo-config into first-time folder and renamed first-time folder to utils --- build.sh | 7 ++++--- stage1/03-install-packages/01-run.sh | 4 ---- stage2/01-sys-tweaks/01-run.sh | 2 +- stage2/{05-firsttime => 05-utils}/00-run.sh | 3 +++ stage2/{05-firsttime => 05-utils}/files/first-time.sh | 11 +++++------ .../05-utils}/files/octo-config | 0 6 files changed, 13 insertions(+), 14 deletions(-) delete mode 100755 stage1/03-install-packages/01-run.sh rename stage2/{05-firsttime => 05-utils}/00-run.sh (74%) rename stage2/{05-firsttime => 05-utils}/files/first-time.sh (91%) rename {stage1/03-install-packages => stage2/05-utils}/files/octo-config (100%) diff --git a/build.sh b/build.sh index 59d61c8..3777193 100755 --- a/build.sh +++ b/build.sh @@ -153,11 +153,12 @@ fi export USE_QEMU="${USE_QEMU:-0}" export IMG_DATE="${IMG_DATE:-"$(date +%Y-%m-%d)"}" -export IMG_FILENAME="${IMG_FILENAME:-"${IMG_DATE}-$(date +%s)-${IMG_NAME}"}" -export ZIP_FILENAME="${ZIP_FILENAME:-"image_${IMG_DATE}-${IMG_NAME}"}" +export IMG_TIME="${IMG_TIME:-"$(date +%s)"}" +export IMG_FILENAME="${IMG_FILENAME:-"${IMG_DATE}-${IMG_TIME}-${IMG_NAME}"}" +export ZIP_FILENAME="${ZIP_FILENAME:-"image_${IMG_DATE}-${IMG_TIME}-${IMG_NAME}"}" export SCRIPT_DIR="${BASE_DIR}/scripts" -export WORK_DIR="${WORK_DIR:-"${BASE_DIR}/work/${IMG_DATE}-${IMG_NAME}"}" +export WORK_DIR="${WORK_DIR:-"${BASE_DIR}/work/${IMG_DATE}-${IMG_TIME}-${IMG_NAME}"}" export DEPLOY_DIR=${DEPLOY_DIR:-"${BASE_DIR}/deploy"} export DEPLOY_ZIP="${DEPLOY_ZIP:-2}" export LOG_FILE="${WORK_DIR}/build.log" diff --git a/stage1/03-install-packages/01-run.sh b/stage1/03-install-packages/01-run.sh deleted file mode 100755 index 88b9e91..0000000 --- a/stage1/03-install-packages/01-run.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -e - -mkdir -p "${ROOTFS_DIR}/usr/local/bin/" -install -m 755 files/octo-config "${ROOTFS_DIR}/usr/local/bin/octo-config" diff --git a/stage2/01-sys-tweaks/01-run.sh b/stage2/01-sys-tweaks/01-run.sh index 813b31f..46b4c11 100755 --- a/stage2/01-sys-tweaks/01-run.sh +++ b/stage2/01-sys-tweaks/01-run.sh @@ -59,4 +59,4 @@ EOF rm -f "${ROOTFS_DIR}/etc/ssh/"ssh_host_*_key* rm -f "${ROOTFS_DIR}/etc/sudoers.d/010_pi-nopasswd" # Fuck you :) -echo "%sudo ALL=(ALL:ALL) ALL" > /etc/sudoers.d/group +echo "%sudo ALL=(ALL:ALL) ALL" > ${ROOTFS_DIR}/etc/sudoers.d/group diff --git a/stage2/05-firsttime/00-run.sh b/stage2/05-utils/00-run.sh similarity index 74% rename from stage2/05-firsttime/00-run.sh rename to stage2/05-utils/00-run.sh index 01edd25..1a1c594 100755 --- a/stage2/05-firsttime/00-run.sh +++ b/stage2/05-utils/00-run.sh @@ -1,5 +1,8 @@ #!/bin/bash -e +mkdir -p "${ROOTFS_DIR}/usr/local/bin/" +install -m 755 files/octo-config "${ROOTFS_DIR}/usr/local/bin/octo-config" + install -m 755 files/first-time.sh ${ROOTFS_DIR}/etc/profile.d/first-time.sh mkdir -p ${ROOTFS_DIR}/etc/systemd/system/getty@tty1.service.d/ diff --git a/stage2/05-firsttime/files/first-time.sh b/stage2/05-utils/files/first-time.sh similarity index 91% rename from stage2/05-firsttime/files/first-time.sh rename to stage2/05-utils/files/first-time.sh index 00afa67..2dab3de 100755 --- a/stage2/05-firsttime/files/first-time.sh +++ b/stage2/05-utils/files/first-time.sh @@ -43,13 +43,13 @@ service_select () { "2") systemctl set-default graphical.target ;; "3") ssh-keygen -A - systemctl enable sshd ;; + systemctl enable ssh ;; esac done } screen_timeout() { - local TIMEOUT=$(whiptail --nocancel --title "Screen Timeout" --inputbox "Input your desired screen timeout in seconds.\nEnter \"off\" to disable the screen timeout." "0" 10 50 "0" 3>&1 1>&2 2>&3) + local TIMEOUT=$(whiptail --nocancel --title "Screen Timeout" --inputbox "Input your desired screen timeout in seconds.\nEnter \"off\" to disable the screen timeout.\n\nAdding a screen timeout can reduce screen burn in." 11 60 "0" 3>&1 1>&2 2>&3) cat > /home/pi/.xprofile << EOF xset s ${TIMEOUT} xset -dpms @@ -74,12 +74,11 @@ main_menu () { } EOF -change_password || exit 1 +change_password || return 1 whiptail --title "Network Configuration" --nocancel --msgbox "Setup will now open nmtui, a program to help configure your ethernet/wireless interfaces. Hit Quit when you are done." 10 50 nmtui -service_select || exit 1 -screen_timeout || exit 1 +service_select || return 1 +screen_timeout || return 1 rm /etc/systemd/system/getty@tty1.service.d/override.conf rm /etc/profile.d/first-time.sh reboot - diff --git a/stage1/03-install-packages/files/octo-config b/stage2/05-utils/files/octo-config similarity index 100% rename from stage1/03-install-packages/files/octo-config rename to stage2/05-utils/files/octo-config