2015-08-20 14:37:06 -06:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
|
2023-08-10 10:37:07 -06:00
|
|
|
# Ourobor.OS Fast Install (obos-fi)
|
|
|
|
# --------------------------------
|
|
|
|
# archdi author : MatMoul
|
2015-08-20 14:57:08 -06:00
|
|
|
# https://github.com/MatMoul
|
|
|
|
# http://sourceforge.net/u/matmoul
|
2023-08-10 10:37:07 -06:00
|
|
|
# obosdi author : LimePotato (Ouroboros)
|
|
|
|
# https://limepot.xyz/
|
|
|
|
# https://git.ouroboros.group/Ouroboros/
|
|
|
|
# https://git.ouroboros.group/LimePotato/
|
|
|
|
#
|
|
|
|
# project : https://git.ouroboros.group/Ouroboros/obos-fi
|
|
|
|
#
|
|
|
|
# license : LGPL-3.0 (http://opensource.org/licenses/lgpl-3.0.html)
|
2015-08-20 14:37:06 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
2023-08-10 10:37:07 -06:00
|
|
|
apptitle="Ourobor.OS Desktop Install (obosdi) - Version: 0.0.1 (GPLv3)"
|
|
|
|
baseurl=https://git.ouroboros.group/Ouroboros/obosdi-pkg/raw/branch/master
|
|
|
|
cachedir=~/.cache/obosdi
|
2015-08-20 14:37:06 -06:00
|
|
|
|
|
|
|
|
2023-08-10 10:37:07 -06:00
|
|
|
cat << EOF > dialog.obosfi
|
2022-11-10 14:31:58 -07:00
|
|
|
use_shadow = OFF
|
2022-11-10 17:27:14 -07:00
|
|
|
title_color = (BLACK,WHITE,OFF)
|
2022-11-10 14:31:58 -07:00
|
|
|
button_label_active_color = (WHITE,BLUE,ON)
|
|
|
|
button_label_inactive_color = (BLACK,WHITE,OFF)
|
|
|
|
tag_color = (BLACK,WHITE,OFF)
|
|
|
|
tag_selected_color = (WHITE,BLUE,ON)
|
|
|
|
tag_key_color = (BLACK,WHITE,OFF)
|
|
|
|
tag_key_selected_color = (WHITE,BLUE,ON)
|
|
|
|
check_color = tag_color
|
|
|
|
check_selected_color = tag_selected_color
|
|
|
|
EOF
|
2023-08-10 10:37:07 -06:00
|
|
|
export DIALOGRC="dialog.obosfi"
|
2015-08-20 14:37:06 -06:00
|
|
|
|
|
|
|
|
|
|
|
# $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
|
2022-11-10 14:27:23 -07:00
|
|
|
sel=$(dialog --backtitle "$apptitle" --title "$title" --cancel-button "Back" --checklist "" 0 0 0 \
|
2015-08-20 14:37:06 -06:00
|
|
|
"${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
|
2022-11-10 14:27:23 -07:00
|
|
|
sel=$(dialog --backtitle "$apptitle" --title "$title" --cancel-button "Back" --checklist "" 0 0 0 \
|
2016-01-11 12:22:39 -07:00
|
|
|
"${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
|
2022-11-17 15:35:18 -07:00
|
|
|
curl -LO $baseurl/$1 2> /dev/null
|
2015-08-20 14:37:06 -06:00
|
|
|
fi
|
|
|
|
chmod $2 $cachedir/$1
|
|
|
|
cd $cachedir
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# $1 : message
|
|
|
|
# $2 : args
|
|
|
|
confirm(){
|
2022-11-10 14:27:23 -07:00
|
|
|
dialog --backtitle "$apptitle" $2 --yesno "$1" 0 0
|
2015-08-20 14:37:06 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
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
|