local-arch-repo/scripts/client.sh

35 lines
1.0 KiB
Bash
Raw Normal View History

2022-01-23 04:30:57 +01:00
#!/bin/bash
# Variables
read -p "Enter your archive server ip address: " server
read -p "Enter your user for rsync daemon credentials: " user
2022-01-23 08:45:26 +01:00
while true; do
read -s -p "Enter your password: " password
echo
read -s -p "Password (again): " password2
echo
[ "$password" = "$password2" ] && break
echo "Please try again"
done
2022-01-23 04:30:57 +01:00
# Hooks
mkdir /etc/pacman.d/hooks/
2022-01-23 05:16:55 +01:00
cp hooks/1.cleanup_cache.hook /etc/pacman.d/hooks/
cp hooks/2.archive_packages-client.hook /etc/pacman.d/hooks/2.archive_packages.hook
2022-01-23 04:30:57 +01:00
# Script/s
2022-01-23 05:16:55 +01:00
cp scripts/archive_packages.sh /root/
2022-01-23 04:30:57 +01:00
chmod +x /root/archive_packages.sh
2022-01-31 19:40:30 +01:00
cp scripts/aur_packages.sh $HOME
chmod +x $HOME/aur_packages.sh
2022-01-23 04:30:57 +01:00
# Rsync credentials
echo "$user" > /etc/rsyncd.user
echo "$password" > /etc/rsyncd.password
echo "$server" > /etc/rsyncd.server
chmod 400 /etc/rsyncd.user /etc/rsyncd.password /etc/rsyncd.server
# Add repository to pacman.conf
echo "[homerepo]
2022-01-31 19:40:30 +01:00
Server = http://$server:8080/archlinux/\$arch" >> /etc/pacman.conf
echo "[homerepo-aur]
Server = http://$server:8080/archlinux/\$arch/aur" >> /etc/pacman.conf