Add trizen as default aur helper

This commit is contained in:
MatMoul 2018-07-22 17:25:41 +02:00
parent b835ae6e16
commit 61146b552f
3 changed files with 67 additions and 59 deletions

View file

@ -26,6 +26,9 @@ options+=("vdir" "vdir --color=auto" on)
options+=("watch" "watch --color" on)
options+=("man" "color function" on)
options+=("mkdir" "mkdir -pv" off)
if [ -f /usr/bin/trizen ]; then
options+=("trizen" "sudo -u aurbuilder trizen" on)
fi
if [ -f /usr/bin/yaourt ]; then
options+=("yaourt" "sudo -u aurbuilder yaourt --color" on)
options+=("yaourt(2)" "sudo -u aurbuilder yaourt" off)
@ -80,6 +83,7 @@ for itm in $sel; do
echo '}' >> /etc/profile.d/alias.sh
;;
'"mkdir"') echo "alias mkdir='mkdir -pv'" >> /etc/profile.d/alias.sh;;
'"trizen"') echo "alias trizen='sudo -u aurbuilder trizen'" >> /etc/profile.d/alias.sh;;
'"yaourt"') echo "alias yaourt='sudo -u aurbuilder yaourt --color'" >> /etc/profile.d/alias.sh;;
'"yaourt(2)"') echo "alias yaourt='sudo -u aurbuilder yaourt'" >> /etc/profile.d/alias.sh;;
'"yaourt(3)"') echo "alias yaourt='yaourt --color'" >> /etc/profile.d/alias.sh;;

22
lib
View file

@ -47,6 +47,12 @@ instpkg(){
pressanykey
fi
if [ ! "$2" = "" ]; then
if [ -f /usr/bin/trizen ]; then
clear
echo "# sudo -u aurbuilder trizen -S --needed $2"
sudo -u aurbuilder trizen -S --needed $2
pressanykey
else
if [ -f /usr/bin/yaourt ]; then
clear
echo "# sudo -u aurbuilder yaourt -S --needed $2"
@ -54,15 +60,7 @@ instpkg(){
pressanykey
else
echo "To install AUR packages, you need to install yaourt or packer in updates menu !"
#if [ -f /usr/bin/packer ]; then
# clear
# echo "# sudo -u aurbuilder packer -S $2"
# sudo -u aurbuilder packer -S $2
# pressanykey
#else
# clear
# echo "To install AUR packages, you need to install yaourt or packer in updates menu !"
#fi
fi
fi
fi
}
@ -104,11 +102,11 @@ chooseaurpkg(){
title=$2
fi
options=()
if [ -f /usr/bin/trizen ]; then
items=$(trizen -Ssq $1)
else
if [ -f /usr/bin/yaourt ]; then
items=$(yaourt -Ssq $1)
else
if [ -f /usr/bin/packer ]; then
items=$(packer -Ssq $1)
fi
fi
for item in $items; do

View file

@ -2,17 +2,17 @@
. ./lib
options=()
if [ -f /usr/bin/trizen ]; then
options+=("Upgrade with trizen" "trizen -Syu")
aurhelper=1
fi
if [ -f /usr/bin/yaourt ]; then
options+=("Upgrade with yaourt" "yaourt -Syua")
aurhelper=1
fi
#if [ -f /usr/bin/packer ]; then
# options+=("Upgrade with packer" "packer -Syu")
# aurhelper=1
#fi
if [ ! "$aurhelper" = "1" ]; then
options+=("Install trizen" "")
options+=("Install yaourt" "")
# options+=("Install packer" "")
options+=("" "")
fi
options+=("Upgrade" "pacman -Syu")
@ -29,22 +29,22 @@ if [ -f /var/lib/pacman/db.lck ]; then
options+=("Remove db.lck" "rm /var/lib/pacman/db.lck")
options+=("" "")
fi
if [ "$aurhelper" = "1" ]; then
if [ ! -f /usr/bin/downgrade ]; then
options+=("Install downgrade" "")
fi
if [ "$aurhelper" = "1" ]; then
if [ ! -f /usr/bin/pkgstats ]; then
options+=("Install pkgstats" "")
fi
if [ ! -f /usr/bin/aurvote ]; then
options+=("Install aurvote" "")
fi
if [ ! -f /usr/bin/trizen ]; then
options+=("Install trizen" "")
fi
if [ ! -f /usr/bin/yaourt ]; then
options+=("Install yaourt" "")
fi
#if [ ! -f /usr/bin/packer ]; then
# options+=("Install packer" "")
#fi
fi
sel=$(whiptail --backtitle "$apptitle" --title "Updates Menu :" --menu "" --cancel-button "Back" 0 0 0 \
@ -63,14 +63,18 @@ checkaurdependencies(){
fi
if [ ! $(id -u "aurbuilder") ]; then
newpass=$(< /dev/urandom tr -dc "@#*%&_A-Z-a-z-0-9" | head -c16)
useradd -r -N -M -d /home/.aurbuilder -s /usr/bin/nologin aurbuilder
useradd -r -N -M -d /tmp/aurbuilder -s /usr/bin/nologin aurbuilder
echo -e "$newpass\n$newpass\n"|passwd aurbuilder
newpass=""
else
usermod -m -d /tmp/aurbuilder aurbuilder
fi
if [ ! -f /etc/sudoers.d/aurbuilder ]; then
echo "aurbuilder ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/aurbuilder
echo "root ALL=(aurbuilder) NOPASSWD: ALL" >> /etc/sudoers.d/aurbuilder
fi
}
checkpackagequerydependencies(){
if [ ! -f /usr/bin/package-query ]; then
mkdir /tmp/aurbuilder
chmod 777 /tmp/aurbuilder
@ -92,14 +96,14 @@ checkarchlinuxfrrepo(){
clear
case $sel in
'Upgrade') pacman -Syu;;
'Upgrade with trizen')
checkaurdependencies
sudo -u aurbuilder trizen -Syu
;;
'Upgrade with yaourt')
checkaurdependencies
sudo -u aurbuilder yaourt -Syua
;;
'Upgrade with packer')
checkaurdependencies
sudo -u aurbuilder packer -Syu
;;
'Clean orphan') pacman -Rns $(pacman -Qqtd);;
'Clean cache') pacman -Sc;;
'Edit pacman.conf') nano /etc/pacman.conf;;
@ -108,15 +112,25 @@ case $sel in
'Refresh pacman keys') pacman-key --refresh-keys;;
'Remove db.lck') rm /var/lib/pacman/db.lck;;
'Install downgrade')
checkarchlinuxfrrepo
pacman -S --needed downgrade
instpkg "" "downgrade"
;;
'Install trizen')
if(confirm "Yaourt allow you to access the AUR applications.\nBecause is not possible to compile applications as root,\nthis installer create an aurbuilder user.\n\nInstall trizen ?") then
clear
checkaurdependencies
mkdir /tmp/aurbuilder
chmod 777 /tmp/aurbuilder
cd /tmp/aurbuilder
sudo -u aurbuilder git clone https://aur.archlinux.org/trizen.git
cd trizen
sudo -u aurbuilder makepkg -si
fi
;;
'Install yaourt')
if(confirm "Yaourt allow you to access the AUR applications.\nBecause is not possible to compile applications as root,\nthis installer create an aurbuilder user.\n\nInstall yaourt ?") then
clear
checkaurdependencies
#checkarchlinuxfrrepo
#pacman -S --needed yaourt
checkpackagequerydependencies
mkdir /tmp/aurbuilder
chmod 777 /tmp/aurbuilder
cd /tmp/aurbuilder
@ -125,14 +139,6 @@ case $sel in
sudo -u aurbuilder makepkg -si
fi
;;
'Install packer')
if(confirm "Packer allow you to access the AUR applications.\nBecause is not possible to compile applications as root,\nthis installer create an aurbuilder user.\n\nInstall packer ?") then
clear
checkaurdependencies
checkarchlinuxfrrepo
pacman -S --needed packer
fi
;;
'Install pkgstats')
pacman -S --needed pkgstats
;;