Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/install_aur
diff options
context:
space:
mode:
authorLord Anton Hvornum <anton.hvo@gmail.com>2018-05-24 20:09:51 +0200
committerLord Anton Hvornum <anton.hvo@gmail.com>2018-05-24 20:09:51 +0200
commit252af79e3dc647cd57a7d4622345d672852bc65e (patch)
treeff07d94510e2a880447c1a66d9cc2b8f4c802840 /install_aur
parent3b07cf27e82e91e8f591ad1b46c218bddeb558f0 (diff)
* New feature: deployment structure can now import/include other templates (Included templates will be installed first, since we'll assume those are baselines/requirements for slimmer deploy-structs)
* Deployment scripts strings now supports python string formatting, if parameter or is given as options to each command-line (TODO: Add as a global parameter as well, and treat all strings as formatable) * Added two templates: workstation + 00:11:22:33:44:55, a example of how to set up a workstation using a template and a custom addition. Also added a default template that is similar to the workstation but does everything in one template. They all use some awk magic to fix alt-tab in Awesome WM, it also creates a "desktop" environment and installs some useful tools and fixes the start menu in Awesome WM. * Reordering mirrors is now a configurable option (Default turned off, to better suit offline environments) * Disk/root password now configurable as either a fixed string, or ask for via STDIN (Syntax for now is: ) * deployment targets now a variable (todo: add a parameter/argument) * SSL support (ignores certificate validation for now, I know this is bad, but until a parameter etc is in place, this has to be a nessecary evil for now) * Cleaned up a lot of custom variables and baked them into so it's easier to format strings based off information gathered along the way (such as partition names). * Error handling: Mostly for missing dependencies and situations, such as not booted in UEFI environment
Diffstat (limited to 'install_aur')
-rw-r--r--install_aur72
1 files changed, 72 insertions, 0 deletions
diff --git a/install_aur b/install_aur
new file mode 100644
index 00000000..6452c428
--- /dev/null
+++ b/install_aur
@@ -0,0 +1,72 @@
+#!/bin/bash
+
+# offline_mirror_path - is used to temporarily store build AUR packages
+# in order to "host" them to the build process.
+# The path will be on the build machine, not inside the build itself.
+
+work_dir=$1
+arch=$2
+offline_mirror_path="/tmp/aur_offline"
+
+# A func to download, build and host AUR packages to the ISO build process
+build_aur () {
+ old_dir=`pwd`
+ package=$1
+ # Prep with a build-user (removed at the end):
+ # TODO: Check if already exists, if so, randomize name/don't remove at the end.
+ # TODO: Don't give permission to wheel, give it only to this user (easy, but needs debugging first)
+ useradd -m -G wheel builder
+ sed -i 's/# %wheel ALL=(ALL) NO/%wheel ALL=(ALL) NO/' /etc/sudoers
+
+ # Extract the AUR package.
+ cd /tmp
+ rm -rf ${package} ${package}.tar.gz
+ wget "https://aur.archlinux.org/cgit/aur.git/snapshot/${package}.tar.gz"
+ tar xvzf "${package}.tar.gz"
+
+ cd ${package}
+ build_dir=$(pwd)
+ chown -R builder.builder /tmp/${package}
+ echo " => Buiilding ${package}"
+ su - builder -c "(cd ${build_dir}; makepkg -s --noconfirm)" >/dev/null 2>&1
+
+
+ echo " => Adding ${package} to local AUR hosting directory ${offline_mirror_path}"
+ mkdir -p ${offline_mirror_path}
+ sh -c "cp *.xz ${offline_mirror_path}/"
+ sh -c "repo-add ${offline_mirror_path}/aur_offline.db.tar.gz ${offline_mirror_path}/*.xz"
+
+ ## Long term storage inside the ISO? (if we want to install from CD to disk or host it to others)
+ # sh -c "mv *.xz ${old_dir}/$2/$1.pkg.tar.xz"
+
+ cd ${old_dir}
+ userdel builder
+ rm -rf /home/builder
+ rm -rf /tmp/${package}
+ rm /tmp/${package}.tar.gz
+}
+
+echo "Starting to sync upstream changes to offline mirror."
+rm -rf /tmp/sync /tmp/local
+
+echo " => Building AUR packages (found in packages.aur)"
+for package in $(cat ${work_dir}/packages.aur); do
+ build_aur package
+done
+
+if [[ -z $(cat ${work_dir}/pacman.conf | grep '\[aur_offline\]') ]]; then
+ echo " => Adding offline mirror to the chroot environment"
+
+ echo "[aur_offline]" >> ${work_dir}/pacman.conf
+ echo "Server = file:///tmp/aur_offline" >> ${work_dir}/pacman.conf
+ echo "SigLevel = Optional TrustAll" >> ${work_dir}/pacman.conf
+fi
+
+## Long term storage, if we want to be able to index our newly build files
+## while installing down to disk later, we need to index the AUR packages.
+#echo " => Adding packages to offline database"
+#sh -c "repo-add --new ${work_dir}/${arch}/airootfs/srv/http/archlinux/arch_offline/os/${arch}/arch_offline.db.tar.gz ${work_dir}/${arch}/airootfs/srv/http/archlinux/arch_offline/os/${arch}/*.pkg.tar.xz" >/dev/null 2>&1
+
+pacman --config ${work_dir}/pacman.conf -Sy
+pacman -Sy
+echo "Done syncing offline mirror."