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

22
lib
View file

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

View file

@ -2,17 +2,17 @@
. ./lib . ./lib
options=() options=()
if [ -f /usr/bin/trizen ]; then
options+=("Upgrade with trizen" "trizen -Syu")
aurhelper=1
fi
if [ -f /usr/bin/yaourt ]; then if [ -f /usr/bin/yaourt ]; then
options+=("Upgrade with yaourt" "yaourt -Syua") options+=("Upgrade with yaourt" "yaourt -Syua")
aurhelper=1 aurhelper=1
fi fi
#if [ -f /usr/bin/packer ]; then
# options+=("Upgrade with packer" "packer -Syu")
# aurhelper=1
#fi
if [ ! "$aurhelper" = "1" ]; then if [ ! "$aurhelper" = "1" ]; then
options+=("Install trizen" "")
options+=("Install yaourt" "") options+=("Install yaourt" "")
# options+=("Install packer" "")
options+=("" "") options+=("" "")
fi fi
options+=("Upgrade" "pacman -Syu") 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+=("Remove db.lck" "rm /var/lib/pacman/db.lck")
options+=("" "") options+=("" "")
fi fi
if [ ! -f /usr/bin/downgrade ]; then
options+=("Install downgrade" "")
fi
if [ "$aurhelper" = "1" ]; then if [ "$aurhelper" = "1" ]; then
if [ ! -f /usr/bin/downgrade ]; then
options+=("Install downgrade" "")
fi
if [ ! -f /usr/bin/pkgstats ]; then if [ ! -f /usr/bin/pkgstats ]; then
options+=("Install pkgstats" "") options+=("Install pkgstats" "")
fi fi
if [ ! -f /usr/bin/aurvote ]; then if [ ! -f /usr/bin/aurvote ]; then
options+=("Install aurvote" "") options+=("Install aurvote" "")
fi fi
if [ ! -f /usr/bin/trizen ]; then
options+=("Install trizen" "")
fi
if [ ! -f /usr/bin/yaourt ]; then if [ ! -f /usr/bin/yaourt ]; then
options+=("Install yaourt" "") options+=("Install yaourt" "")
fi fi
#if [ ! -f /usr/bin/packer ]; then
# options+=("Install packer" "")
#fi
fi fi
sel=$(whiptail --backtitle "$apptitle" --title "Updates Menu :" --menu "" --cancel-button "Back" 0 0 0 \ sel=$(whiptail --backtitle "$apptitle" --title "Updates Menu :" --menu "" --cancel-button "Back" 0 0 0 \
@ -63,14 +63,18 @@ checkaurdependencies(){
fi fi
if [ ! $(id -u "aurbuilder") ]; then if [ ! $(id -u "aurbuilder") ]; then
newpass=$(< /dev/urandom tr -dc "@#*%&_A-Z-a-z-0-9" | head -c16) 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 echo -e "$newpass\n$newpass\n"|passwd aurbuilder
newpass="" newpass=""
else
usermod -m -d /tmp/aurbuilder aurbuilder
fi fi
if [ ! -f /etc/sudoers.d/aurbuilder ]; then if [ ! -f /etc/sudoers.d/aurbuilder ]; then
echo "aurbuilder ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/aurbuilder echo "aurbuilder ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/aurbuilder
echo "root ALL=(aurbuilder) NOPASSWD: ALL" >> /etc/sudoers.d/aurbuilder echo "root ALL=(aurbuilder) NOPASSWD: ALL" >> /etc/sudoers.d/aurbuilder
fi fi
}
checkpackagequerydependencies(){
if [ ! -f /usr/bin/package-query ]; then if [ ! -f /usr/bin/package-query ]; then
mkdir /tmp/aurbuilder mkdir /tmp/aurbuilder
chmod 777 /tmp/aurbuilder chmod 777 /tmp/aurbuilder
@ -92,14 +96,14 @@ checkarchlinuxfrrepo(){
clear clear
case $sel in case $sel in
'Upgrade') pacman -Syu;; 'Upgrade') pacman -Syu;;
'Upgrade with trizen')
checkaurdependencies
sudo -u aurbuilder trizen -Syu
;;
'Upgrade with yaourt') 'Upgrade with yaourt')
checkaurdependencies checkaurdependencies
sudo -u aurbuilder yaourt -Syua sudo -u aurbuilder yaourt -Syua
;; ;;
'Upgrade with packer')
checkaurdependencies
sudo -u aurbuilder packer -Syu
;;
'Clean orphan') pacman -Rns $(pacman -Qqtd);; 'Clean orphan') pacman -Rns $(pacman -Qqtd);;
'Clean cache') pacman -Sc;; 'Clean cache') pacman -Sc;;
'Edit pacman.conf') nano /etc/pacman.conf;; 'Edit pacman.conf') nano /etc/pacman.conf;;
@ -108,15 +112,25 @@ case $sel in
'Refresh pacman keys') pacman-key --refresh-keys;; 'Refresh pacman keys') pacman-key --refresh-keys;;
'Remove db.lck') rm /var/lib/pacman/db.lck;; 'Remove db.lck') rm /var/lib/pacman/db.lck;;
'Install downgrade') 'Install downgrade')
checkarchlinuxfrrepo instpkg "" "downgrade"
pacman -S --needed 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') '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 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 clear
checkaurdependencies checkaurdependencies
#checkarchlinuxfrrepo checkpackagequerydependencies
#pacman -S --needed yaourt
mkdir /tmp/aurbuilder mkdir /tmp/aurbuilder
chmod 777 /tmp/aurbuilder chmod 777 /tmp/aurbuilder
cd /tmp/aurbuilder cd /tmp/aurbuilder
@ -125,14 +139,6 @@ case $sel in
sudo -u aurbuilder makepkg -si sudo -u aurbuilder makepkg -si
fi 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') 'Install pkgstats')
pacman -S --needed pkgstats pacman -S --needed pkgstats
;; ;;