From c9439f85e76d22520114d1c10bfc3e061adc5f21 Mon Sep 17 00:00:00 2001 From: Dan Date: Sat, 5 Feb 2022 14:44:03 +1300 Subject: [PATCH] added aurhelper check for pacman.conf aur-repo and sync command --- scripts/client.sh | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/scripts/client.sh b/scripts/client.sh index 0bb01fd..a561649 100644 --- a/scripts/client.sh +++ b/scripts/client.sh @@ -1,5 +1,8 @@ #!/bin/bash # Variables +real_user=$SUDO_USER + +# rsync daemon credentials read -p "Enter your archive server ip address: " server read -p "Enter your user for rsync daemon credentials: " user while true; do @@ -19,8 +22,13 @@ cp hooks/2.archive_packages-client.hook /etc/pacman.d/hooks/2.archive_packages.h # Script/s cp scripts/archive_packages.sh /root/ chmod +x /root/archive_packages.sh -cp scripts/aur_packages.sh $HOME -chmod +x $HOME/aur_packages.sh + +if AURHELPER=$(pacman -Qmq | grep -E 'yay|pikaur|paru|trizen') ; then + echo "Set $AURHELPER rsync command to archive_packages.sh script.">&2 + echo "rsync -chavzP --password-file=/etc/rsyncd.password --ignore-existing /home/$real_user/.cache/$aurhelper/pkg/* rsync://\$user@\$server/archiverepo/archlinux/\$arch/aur" >> /root/archive_packages.sh +else + echo "No AUR helper installed.">&2 +fi # Rsync credentials echo "$user" > /etc/rsyncd.user @@ -29,7 +37,12 @@ echo "$server" > /etc/rsyncd.server chmod 400 /etc/rsyncd.user /etc/rsyncd.password /etc/rsyncd.server # Add repository to pacman.conf +if AURHELPER=$(pacman -Qmq | grep -E 'yay|pikaur|paru|trizen') ; then + echo "[homerepo-aur] + Server = http://$server:8080/archlinux/\$arch/aur + SigLevel = Never" >> /etc/pacman.conf +else + echo "No AUR helper installed.">&2 +fi echo "[homerepo] -Server = http://$server:8080/archlinux/\$arch" >> /etc/pacman.conf -echo "[homerepo-aur] -Server = http://$server:8080/archlinux/\$arch/aur" >> /etc/pacman.conf \ No newline at end of file +Server = http://$server:8080/archlinux/\$arch" >> /etc/pacman.conf \ No newline at end of file