2015-08-20 14:37:06 -06:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
|
|
|
|
# Arch Linux Desktop Install (archdi)
|
|
|
|
# -----------------------------------
|
2015-08-20 14:57:08 -06:00
|
|
|
# author : MatMoul
|
|
|
|
# https://github.com/MatMoul
|
|
|
|
# http://sourceforge.net/u/matmoul
|
|
|
|
# project : https://github.com/MatMoul/archdi
|
|
|
|
# http://sourceforge.net/projects/archdi/
|
|
|
|
# license : GPLv3 (http://opensource.org/licenses/GPL-3.0)
|
2015-08-20 14:37:06 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
2022-10-15 20:53:43 -06:00
|
|
|
apptitle="Arch Linux Desktop Install (archdi) - Version: 2022.10.16.04.53.34 (GPLv3)"
|
2015-08-20 15:11:27 -06:00
|
|
|
baseurl=https://raw.githubusercontent.com/MatMoul/archdi-pkg/master
|
2015-08-20 14:37:06 -06:00
|
|
|
cachedir=~/.cache/archdi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# $1: path
|
|
|
|
menu(){
|
|
|
|
require $1 755
|
|
|
|
$cachedir/$1
|
|
|
|
if [ $? = 0 ]; then
|
|
|
|
menu $1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# $1: path
|
|
|
|
script(){
|
|
|
|
require $1 755
|
|
|
|
$cachedir/$1
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# $1: pacman packages
|
|
|
|
# $2: aur packages
|
|
|
|
instpkg(){
|
|
|
|
if [ ! "$1" = "" ]; then
|
|
|
|
clear
|
|
|
|
echo "# pacman -S --needed $1"
|
|
|
|
pacman -S --needed $1
|
|
|
|
pressanykey
|
|
|
|
fi
|
|
|
|
if [ ! "$2" = "" ]; then
|
2018-07-22 09:25:41 -06:00
|
|
|
if [ -f /usr/bin/trizen ]; then
|
2015-08-20 14:37:06 -06:00
|
|
|
clear
|
2018-07-22 09:25:41 -06:00
|
|
|
echo "# sudo -u aurbuilder trizen -S --needed $2"
|
|
|
|
sudo -u aurbuilder trizen -S --needed $2
|
2015-08-20 14:37:06 -06:00
|
|
|
pressanykey
|
|
|
|
else
|
2018-07-22 10:30:02 -06:00
|
|
|
if [ -f /usr/bin/yay ]; then
|
2018-07-22 09:25:41 -06:00
|
|
|
clear
|
2018-07-22 10:30:02 -06:00
|
|
|
echo "# sudo -u aurbuilder yay -S --needed $2"
|
|
|
|
sudo -u aurbuilder yay -S --needed $2
|
2018-07-22 09:25:41 -06:00
|
|
|
pressanykey
|
|
|
|
else
|
2018-07-22 10:30:02 -06:00
|
|
|
if [ -f /usr/bin/aurman ]; then
|
|
|
|
clear
|
|
|
|
echo "# sudo -u aurbuilder aurman -S --needed $2"
|
|
|
|
sudo -u aurbuilder aurman -S --needed $2
|
|
|
|
pressanykey
|
|
|
|
else
|
|
|
|
if [ -f /usr/bin/yaourt ]; then
|
|
|
|
clear
|
|
|
|
echo "# sudo -u aurbuilder yaourt -S --needed $2"
|
|
|
|
sudo -u aurbuilder yaourt -S --needed $2
|
|
|
|
pressanykey
|
|
|
|
else
|
2018-09-15 18:12:24 -06:00
|
|
|
echo "To install AUR packages, you need to install an aurhelper in updates menu !"
|
2018-07-22 10:30:02 -06:00
|
|
|
fi
|
|
|
|
fi
|
2018-07-22 09:25:41 -06:00
|
|
|
fi
|
2015-08-20 14:37:06 -06:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# $1: string
|
|
|
|
# $2: [title]
|
|
|
|
choosepkg(){
|
|
|
|
if [ "$2" = "" ]; then
|
|
|
|
title=$1
|
|
|
|
else
|
|
|
|
title=$2
|
|
|
|
fi
|
|
|
|
options=()
|
|
|
|
items=$(pacman -Ssq $1)
|
|
|
|
for item in $items; do
|
|
|
|
options+=("$item" "" off)
|
|
|
|
done
|
|
|
|
sel=$(whiptail --backtitle "$apptitle" --title "$title" --checklist "" --cancel-button "Back" 0 0 0 \
|
|
|
|
"${options[@]}" \
|
|
|
|
3>&1 1>&2 2>&3)
|
|
|
|
if [ ! "$?" = "0" ]; then
|
2016-04-08 19:13:53 -06:00
|
|
|
return 1
|
2015-08-20 14:37:06 -06:00
|
|
|
fi
|
|
|
|
for itm in $sel; do
|
|
|
|
pkg="$pkg $(echo $itm | sed 's/"//g')"
|
|
|
|
done
|
|
|
|
instpkg "$pkg" "$aurpkg"
|
2016-04-08 19:13:53 -06:00
|
|
|
return 0
|
2015-08-20 14:37:06 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-01-11 12:22:39 -07:00
|
|
|
# $1: string
|
|
|
|
# $2: [title]
|
|
|
|
chooseaurpkg(){
|
|
|
|
if [ "$2" = "" ]; then
|
|
|
|
title=$1
|
|
|
|
else
|
|
|
|
title=$2
|
|
|
|
fi
|
|
|
|
options=()
|
2018-07-22 09:25:41 -06:00
|
|
|
if [ -f /usr/bin/trizen ]; then
|
|
|
|
items=$(trizen -Ssq $1)
|
2016-01-11 12:22:39 -07:00
|
|
|
else
|
2018-07-22 10:30:02 -06:00
|
|
|
if [ -f /usr/bin/yay ]; then
|
|
|
|
items=$(yay -Ssq $1)
|
|
|
|
else
|
|
|
|
if [ -f /usr/bin/aurman ]; then
|
|
|
|
items=$(aurman -Ssq $1)
|
|
|
|
else
|
|
|
|
if [ -f /usr/bin/yaourt ]; then
|
|
|
|
items=$(yaourt -Ssq $1)
|
|
|
|
fi
|
|
|
|
fi
|
2016-01-11 12:22:39 -07:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
for item in $items; do
|
|
|
|
options+=("$item" "" off)
|
|
|
|
done
|
|
|
|
sel=$(whiptail --backtitle "$apptitle" --title "$title" --checklist "" --cancel-button "Back" 0 0 0 \
|
|
|
|
"${options[@]}" \
|
|
|
|
3>&1 1>&2 2>&3)
|
|
|
|
if [ ! "$?" = "0" ]; then
|
2016-04-08 19:13:53 -06:00
|
|
|
return 1
|
2016-01-11 12:22:39 -07:00
|
|
|
fi
|
|
|
|
for itm in $sel; do
|
|
|
|
aurpkg="$aurpkg $(echo $itm | sed 's/"//g')"
|
|
|
|
done
|
|
|
|
instpkg "$pkg" "$aurpkg"
|
2016-04-08 19:13:53 -06:00
|
|
|
return 0
|
2016-01-11 12:22:39 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-08-20 14:37:06 -06:00
|
|
|
# $1: path
|
|
|
|
# $2: chmod
|
|
|
|
require(){
|
|
|
|
if [ ! -f "$cachedir/$1" ]; then
|
|
|
|
path=$(dirname $1)
|
|
|
|
mkdir -p $cachedir/$path 2> /dev/null
|
|
|
|
cd $cachedir/$path
|
|
|
|
wget $baseurl/$1 2> /dev/null
|
|
|
|
fi
|
|
|
|
chmod $2 $cachedir/$1
|
|
|
|
cd $cachedir
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# $1 : message
|
|
|
|
# $2 : args
|
|
|
|
confirm(){
|
|
|
|
whiptail --backtitle "$apptitle" --yesno "$1" $2 0 0
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
pressanykey(){
|
|
|
|
read -n1 -p "Press any key to continue."
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-09-15 16:20:14 -06:00
|
|
|
# $1 : filename
|
|
|
|
editfile(){
|
|
|
|
editor=$EDITOR
|
|
|
|
if [ "$editor" == "" ]; then
|
|
|
|
editor="nano"
|
|
|
|
fi
|
2019-01-02 18:00:59 -07:00
|
|
|
if [ ! -f "/usr/bin/$editor" ]; then
|
|
|
|
editor="nano"
|
|
|
|
fi
|
2018-09-15 16:20:14 -06:00
|
|
|
echo "$editor $1"
|
|
|
|
$editor "$1"
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-08-20 14:37:06 -06:00
|
|
|
# $1 : servicename
|
|
|
|
# $2 : [displayname]
|
|
|
|
svcstart(){
|
|
|
|
if [ "$2" = "" ]; then
|
|
|
|
displayname="$1"
|
|
|
|
else
|
|
|
|
displayname="$2 ($1)"
|
|
|
|
fi
|
|
|
|
if (confirm "Start $displayname service ?\n\nsystemctl start $1") then
|
2018-09-15 18:12:24 -06:00
|
|
|
clear
|
|
|
|
echo "systemctl start $1"
|
2015-08-20 14:37:06 -06:00
|
|
|
systemctl start $1
|
2018-09-15 18:12:24 -06:00
|
|
|
pressanykey
|
|
|
|
else
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
# $1 : servicename
|
|
|
|
# $2 : [displayname]
|
|
|
|
svcrestart(){
|
|
|
|
if [ "$2" = "" ]; then
|
|
|
|
displayname="$1"
|
|
|
|
else
|
|
|
|
displayname="$2 ($1)"
|
|
|
|
fi
|
|
|
|
if (confirm "Restart $displayname service ?\n\nsystemctl restart $1") then
|
|
|
|
clear
|
|
|
|
echo "systemctl restart $1"
|
|
|
|
systemctl restart $1
|
|
|
|
pressanykey
|
|
|
|
else
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
# $1 : servicename
|
|
|
|
# $2 : [displayname]
|
|
|
|
svcstop(){
|
|
|
|
if [ "$2" = "" ]; then
|
|
|
|
displayname="$1"
|
|
|
|
else
|
|
|
|
displayname="$2 ($1)"
|
|
|
|
fi
|
|
|
|
if (confirm "Stop $displayname service ?\n\nsystemctl stop $1") then
|
|
|
|
clear
|
|
|
|
echo "systemctl stop $1"
|
|
|
|
systemctl stop $1
|
|
|
|
pressanykey
|
2015-08-20 14:37:06 -06:00
|
|
|
else
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
# $1 : servicename
|
|
|
|
# $2 : [displayname]
|
|
|
|
svcenable(){
|
|
|
|
if [ "$2" = "" ]; then
|
|
|
|
displayname="$1"
|
|
|
|
else
|
|
|
|
displayname="$2 ($1)"
|
|
|
|
fi
|
|
|
|
if (confirm "Start $displayname service at boot ?\n\nsystemctl enable $1") then
|
2018-09-15 18:12:24 -06:00
|
|
|
clear
|
|
|
|
echo "systemctl enable $1"
|
2015-08-20 14:37:06 -06:00
|
|
|
systemctl enable $1
|
2018-09-15 18:12:24 -06:00
|
|
|
pressanykey
|
2015-08-29 15:57:08 -06:00
|
|
|
#else
|
|
|
|
# exit 1
|
2015-08-20 14:37:06 -06:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
# $1 : servicename
|
|
|
|
# $2 : [displayname]
|
|
|
|
svcdisable(){
|
|
|
|
if [ "$2" = "" ]; then
|
|
|
|
displayname="$1"
|
|
|
|
else
|
|
|
|
displayname="$2 ($1)"
|
|
|
|
fi
|
|
|
|
if (confirm "Disable $displayname service at boot ?\n\nsystemctl disable $1") then
|
2018-09-15 18:12:24 -06:00
|
|
|
clear
|
|
|
|
echo "systemctl disable $1"
|
2015-08-20 14:37:06 -06:00
|
|
|
systemctl disable $1
|
2018-09-15 18:12:24 -06:00
|
|
|
pressanykey
|
2015-08-29 15:57:08 -06:00
|
|
|
#else
|
|
|
|
# exit 1
|
2015-08-20 14:37:06 -06:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
while (( "$#" )); do
|
|
|
|
case $1 in
|
|
|
|
--root)
|
|
|
|
menu menu
|
|
|
|
exit 0
|
|
|
|
;;
|
|
|
|
--chroot)
|
|
|
|
require menu 755
|
|
|
|
sed -i "/options+=(\"Shutdown\" \"\")/d" menu
|
|
|
|
menu menu
|
|
|
|
exit 0
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
shift
|
|
|
|
done
|