#!/bin/bash #/srv/ArchBuilds # Set Vars LOG_DIR="/mnt/Build/logs" OUT_DIR="/mnt/Build/isos" TMP_DIR="/mnt/Scratch" DATE="$(date +%F)" DATETIME="$(date +%F_%H%M)" if [[ "$EUID" -eq 0 ]]; then ## Elevated section ## # Set permissions echo "Setting permissions..." chown root.root archlive -R chmod 700 archlive/airootfs/etc/skel/.ssh chmod 600 archlive/airootfs/etc/skel/.ssh/id_rsa # Modify build.sh if ! grep -iq 'customize_iso' archlive/build.sh; then sed -ir 's!run_once make_iso!# customize_iso\ncp -a ${script_path}/extra/* ${work_dir}/iso/\n\nrun_once make_iso!' archlive/build.sh fi # Build ISO mkdir $LOG_DIR mkdir $OUT_DIR mkdir $TMP_DIR ./archlive/build.sh -N "wk-arch" -V "$DATE" -L "WK_ARCH" -w "$TMP_DIR" -o "$OUT_DIR" -v | tee -a "$LOG_DIR/$DATETIME.log" # Cleanup echo "Removing temp files..." rm "$TMP_DIR" -Rf | tee -a "$LOG_DIR/$DATETIME.log" echo "Reverting permissions..." chown builduser.builduser archlive -R else ## Non-elevated section ## # Prep mkdir wk-repo pushd wk-repo >/dev/null BEFORE=$(date "+%F_%H%M%S") mkdir _done/$BEFORE -p find . -maxdepth 1 -not -name 'update' -and -not -name '_done' -exec mv -nv "{}" _done/$BEFORE/ \; rmdir _done/* --ignore-fail-on-non-empty sleep 1s AFTER=$(date "+%F_%H%M%S") # Install Dependancies sudo pacman -Syu base-devel libewf attr progsreiserfs --needed --noconfirm #for p in lha; do # echo "Installing dependancy: $p" # curl -LsfO https://aur.archlinux.org/cgit/aur.git/snapshot/$p.tar.gz # tar xf $p.tar.gz # pushd $p >/dev/null # makepkg -si --needed --noconfirm # popd >/dev/null # mv -n $p $p.tar.gz _done/$AFTER/ #done # Build custom repo packages mkdir _done/$AFTER for p in aic94xx-firmware bash-pipes gtk-theme-arc-git hfsprogs i3-gaps i3lock-fancy-git mprime-bin openbox-patched papirus-icon-theme pasystray testdisk-wip ttf-font-awesome wd719x-firmware wimlib; do echo "Building: $p" curl -LsfO https://aur.archlinux.org/cgit/aur.git/snapshot/$p.tar.gz tar xf $p.tar.gz pushd $p >/dev/null makepkg -s --noconfirm popd >/dev/null mv -n $p/*xz ./ mv -n $p $p.tar.gz _done/$AFTER/ done # Build custom repo database for p in *xz; do repo-add wk-repo.db.tar.gz $p done popd >/dev/null # Rerun script as root to start Archiso build process sudo "$0" fi