Switched to i3/dunst/rofi over xfce4 * Custom Repo overhaul * build-wk downloads, builds, and adds packages to the custom-repo * Dropped i686 support * HW-Diag scripts should now "support" virtual drives * e.g. /dev/vda (for easier testing) * Bugfix: removed resolv.conf symlink to fix NetworkManager
78 lines
2.3 KiB
Bash
78 lines
2.3 KiB
Bash
#!/bin/bash
|
|
#/srv/ArchBuilds
|
|
# Set Vars
|
|
LOG_DIR="/srv/ArchBuilds/BuildLogs"
|
|
OUT_DIR="/srv/ArchBuilds/isos"
|
|
TMP_DIR="/srv/ScratchDir"
|
|
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
|
|
|
|
# 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 i3-gaps i3lock-fancy-git mprime-bin 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
|