diff --git a/Build Linux b/Build Linux index a2cb9244..1e2ea1e4 100755 --- a/Build Linux +++ b/Build Linux @@ -40,7 +40,7 @@ function ask() { fi done } - + function cleanup() { for d in "$TEMP_DIR" "$LIVE_DIR"; do if [[ -d "$d" ]]; then @@ -116,7 +116,7 @@ function copy_live_env() { rmdir "$LIVE_DIR/airootfs/etc/udev" --ignore-fail-on-non-empty rm "$LIVE_DIR/isolinux"/*.cfg rm "$LIVE_DIR/syslinux"/*.cfg "$LIVE_DIR/syslinux"/*.png - + # Add items rsync -aI "$ROOT_DIR/.linux_items/include/" "$LIVE_DIR/" if [[ "${1:-}" != "--minimal" ]]; then @@ -195,7 +195,7 @@ function update_live_env() { # Hostname echo "$hostname" > "$LIVE_DIR/airootfs/etc/hostname" echo "127.0.1.1 $hostname.localdomain $hostname" >> "$LIVE_DIR/airootfs/etc/hosts" - + # Live packages while read -r p; do sed -i "/$p/d" "$LIVE_DIR/packages.x86_64" @@ -215,7 +215,7 @@ function update_live_env() { sed -i -r 's/^(.*mirrorlist.*)$/#NOPE#\1/' "$LIVE_DIR/airootfs/root/customize_airootfs.sh" echo "curl -o '/etc/pacman.d/mirrorlist' '$MIRRORLIST_SOURCE'" >> "$LIVE_DIR/airootfs/root/customize_airootfs.sh" echo "sed -i 's/#Server/Server/g' /etc/pacman.d/mirrorlist" >> "$LIVE_DIR/airootfs/root/customize_airootfs.sh" - + # MOTD sed -i -r "s/_+/$KIT_NAME_FULL Linux Environment/" "$LIVE_DIR/airootfs/etc/motd" @@ -223,7 +223,7 @@ function update_live_env() { git clone --depth=1 https://github.com/robbyrussell/oh-my-zsh.git "$SKEL_DIR/.oh-my-zsh" rm -Rf "$SKEL_DIR/.oh-my-zsh/.git" curl -o "$SKEL_DIR/.oh-my-zsh/themes/lean.zsh-theme" https://raw.githubusercontent.com/miekg/lean/master/prompt_lean_setup - + if [[ "${1:-}" != "--minimal" ]]; then # Openbox theme git clone --depth=1 https://github.com/addy-dclxvi/Openbox-Theme-Collections.git "$TEMP_DIR/ob-themes" @@ -238,7 +238,7 @@ function update_live_env() { # Shutdown stall fix echo "sed -i -r 's/^.*(DefaultTimeoutStartSec)=.*$/\1=15s/' /etc/systemd/system.conf" >> "$LIVE_DIR/airootfs/root/customize_airootfs.sh" echo "sed -i -r 's/^.*(DefaultTimeoutStopSec)=.*$/\1=15s/' /etc/systemd/system.conf" >> "$LIVE_DIR/airootfs/root/customize_airootfs.sh" - + # SSH mkdir -p "$SKEL_DIR/.ssh" ssh-keygen -b 4096 -C "$username@$hostname" -N "" -f "$SKEL_DIR/.ssh/id_rsa" @@ -247,7 +247,7 @@ function update_live_env() { sed -i -r '/.*PermitRootLogin.*/d' "$LIVE_DIR/airootfs/root/customize_airootfs.sh" echo "sed -i -r '/.*PermitRootLogin.*/d' /etc/ssh/sshd_config" >> "$LIVE_DIR/airootfs/root/customize_airootfs.sh" cp "$ROOT_DIR/.linux_items/authorized_keys" "$SKEL_DIR/.ssh/authorized_keys" - + # Root user echo "echo 'root:$ROOT_PASSWORD' | chpasswd" >> "$LIVE_DIR/airootfs/root/customize_airootfs.sh" @@ -339,7 +339,7 @@ function build_iso() { echo "Aborted." exit 1 fi - + # Set permissions echo "Setting permissions..." chown root:root "$LIVE_DIR" -R @@ -354,7 +354,7 @@ function build_iso() { fi done done - + # Build ISO prefix="${KIT_NAME_SHORT}-Linux" label="${KIT_NAME_SHORT}_LINUX" @@ -369,13 +369,44 @@ function build_iso() { chown $REAL_USER:$REAL_USER "$OUT_DIR" -R } +function build_all() { + if [[ "$EUID" -eq 0 ]]; then + echo "This section not meant to be run as root." + echo "Aborted." + exit 1 + fi + + # Prep for build (full) + cleanup + fix_kit_permissions + install_deps + load_settings --edit + update_repo + copy_live_env + update_live_env + # Rerun script as root to start Archiso build process + run_elevated "$(realpath "$0")" --build-iso + # Cleanup + mv -nv "$LIVE_DIR" "${LIVE_DIR}.full" + perl-rename -v "s/^(${KIT_NAME_FULL}-Linux)-(${DATE}.*)$/\1-Full-\2/" "$OUT_DIR"/* + + # Prep for build (minimal) + copy_live_env --minimal + update_live_env --minimal + # Rerun script as root to start Archiso build process + run_elevated "$(realpath "$0")" --build-iso + # Cleanup + mv -nv "$LIVE_DIR" "${LIVE_DIR}.minimal" + perl-rename -v "s/^(${KIT_NAME_FULL}-Linux)-(${DATE}.*)$/\1-Minimal-\2/" "$OUT_DIR"/* +} + function build_full() { if [[ "$EUID" -eq 0 ]]; then echo "This section not meant to be run as root." echo "Aborted." exit 1 fi - + # Prep for build cleanup fix_kit_permissions @@ -390,6 +421,11 @@ function build_full() { # Check input case ${1:-} in + -a|--build-all) + build_all + echo Done + ;; + -b|--build-full) build_full echo Done @@ -417,7 +453,7 @@ case ${1:-} in build_iso echo Done ;; - + -p|--prep-live-env) load_settings --edit copy_live_env @@ -434,7 +470,8 @@ case ${1:-} in echo "Usage: $(basename "$0") [OPTIONS]" echo "" echo "Options:" - echo " -b --build-full Perform all tasks and build iso" + echo " -a --build-all Perform all tasks to build all isos" + echo " -b --build-full Perform all tasks to build the full iso" echo " -h --help Show usage" echo "" echo "Advanced options:"