Hook to configure pacman.conf inside containers

This commit is contained in:
Xavier Moffett 2024-09-15 18:14:22 -04:00
parent 7234f89202
commit 04473dc27e
Signed by: Sapphirus
GPG key ID: A6C061B2CEA1A7AC
3 changed files with 21 additions and 1 deletions

10
dist/src/1-pacwrap-dist.hook vendored Normal file
View file

@ -0,0 +1,10 @@
[Trigger]
Operation = Install
Operation = Upgrade
Type = Package
Target = pacman
[Action]
Description = Configuring pacman..
When = PostTransaction
Exec = /usr/share/libalpm/scripts/pacwrap-dist pacman

11
dist/src/pacwrap-dist vendored
View file

@ -54,7 +54,6 @@ timezone() {
fi
echo "Setting localtime to UTC..."
ln -s ../usr/share/zoneinfo/UCT /etc/localtime
}
@ -65,6 +64,15 @@ dist() {
echo "Distribution configuration completed."
}
pacman() {
if [[ "$(cat /etc/pacman.conf | grep "#DownloadUser")" ]]; then
return
fi
sed -i 's/DownloadUser =/#DownloadUser=/g;s/CheckSpace/#CheckSpace/g' /etc/pacman.conf
if [[ $? == 0 ]]; then echo "Configured pacman.conf"; fi
}
cert_store() {
chmod -R 755 /usr/share/ca-certificates /etc/ca-certificates
@ -78,5 +86,6 @@ cert_store() {
case $1 in
cert-store) cert_store;;
config) dist;;
pacman) pacman;;
*) echo "error: Hook parameter '$1' not found.";;
esac

View file

@ -94,6 +94,7 @@ populate_usr() {
ln -s /usr/lib/flatpak-xdg-utils/xdg-email "${DEST_DIR}/usr/local/bin/"
install -Dm 644 "$DIST_SRC/0-pacwrap-dist.hook" "${DEST_DIR}/usr/share/libalpm/hooks/0-pacwrap-dist.hook"
install -Dm 644 "$DIST_SRC/1-pacwrap-dist.hook" "${DEST_DIR}/usr/share/libalpm/hooks/1-pacwrap-dist.hook"
install -Dm 644 "$DIST_SRC/42-trust-permission.hook" "${DEST_DIR}/usr/share/libalpm/hooks/42-trust-permission.hook"
# TODO: Perhaps identify ourselves as our own distribution of Arch Linux?
# install -Dm 644 "$DIST_SRC/os-release" "${DEST_DIR}/usr/lib/os-release"