Fix AUR installation (needing pseudo-user)

This commit is contained in:
Augusto Gunsch 2021-08-12 20:19:15 -03:00
parent 8c0eba70e4
commit ac2d3835e8
No known key found for this signature in database
GPG Key ID: F7EEFE29825C72DC
1 changed files with 30 additions and 6 deletions

View File

@ -58,6 +58,8 @@ if [ "$DISTRO" != "arch" -a "$DISTRO" != "artix" ]; then
echo "Error: $DISTRO not supported" echo "Error: $DISTRO not supported"
usage usage
fi fi
AUR_BUILD_DIR="/tmp/aur-build"
readonly AUR_BUILD_DIR
readonly PACMAN_CONF readonly PACMAN_CONF
readonly PACMAN_TEMP_CONF readonly PACMAN_TEMP_CONF
readonly DOAS_CONF readonly DOAS_CONF
@ -174,18 +176,25 @@ print_phase() {
} }
install_aur() { install_aur() {
[ -z "$INSTALL_USER" ] && return 0
if [ -z "$2" ]; then if [ -z "$2" ]; then
echo -ne "Installing ${LGREEN}$1${NC} from AUR..." echo -ne "Installing ${LGREEN}$1${NC} from AUR..."
else else
echo -ne "Installing ${LGREEN}$1${NC} from AUR ($2)..." echo -ne "Installing ${LGREEN}$1${NC} from AUR ($2)..."
fi fi
local dir="$HOME_DIR/$1" qpushd "$AUR_BUILD_DIR"
quiet sudo -u "$INSTALL_USER" git clone -q "https://aur.archlinux.org/$1.git" "$dir" quiet sudo -u nobody git clone -q "https://aur.archlinux.org/$1.git" "$1"
qpushd "$dir" qpushd "$1"
quiet sudo -u "$INSTALL_USER" makepkg -si --noconfirm
#dependencies
for pkg in $(sudo -u nobody makepkg --printsrcinfo | awk '$1 ~ /^makedepends$/ {print $3}'); do
install $pkg
done
quiet sudo -u nobody makepkg --noconfirm
quiet pacman -U --noconfirm "$1*.pkg.tar*"
qpopd
rm -rf "$1"
qpopd qpopd
rm -rf "$dir"
echo "done" echo "done"
} }
@ -550,11 +559,26 @@ change_shells() {
echo "done" echo "done"
} }
aur_build_setup() {
echo -n "Setting up temporary build directory ($AUR_BUILD_DIR)..."
mkdir -p "$AUR_BUILD_DIR"
chown nobody:nobody "$AUR_BUILD_DIR"
echo "done"
}
aur_build_remove() {
echo -n "Removeing temporary build directory..."
rm -rf "$AUR_BUILD_DIR"
echo "done"
}
main() { main() {
repos repos
aur_build_setup
install_packages install_packages
install_dotfiles install_dotfiles
configure_doas configure_doas
aur_build_remove
} }
main main