make-debian-look-like-ubuntu/setup.sh

100 lines
2.1 KiB
Bash
Raw Normal View History

2023-06-12 21:06:54 +02:00
#!/bin/bash
arguments="$@"
# get the $packages Array
. include/packages.inc.sh
# colors for colored output 8)
RED="\e[31m"
GREEN="\e[32m"
YELLOW="\e[33m"
ENDCOLOR="\e[0m"
function message() {
case $1 in
warn)
MESSAGE_TYPE="${YELLOW}WARN${ENDCOLOR}"
;;
error)
MESSAGE_TYPE="${RED}ERROR${ENDCOLOR}"
;;
info|*)
MESSAGE_TYPE="${GREEN}INFO${ENDCOLOR}"
;;
esac
if [ "$1" == "info" ] || [ "$1" == "warn" ] || [ "$1" == "error" ]
then
MESSAGE=$2
else
MESSAGE=$1
fi
echo -e "[${MESSAGE_TYPE}] $MESSAGE"
}
error ()
{
message error "ERROR!!"
exit 1
}
###
if [ -z "$arguments" ]
then
package_categories="${!packages[@]}"
else
package_categories="$@"
fi
message warn "Do you want to install these categories?"
message warn "${YELLOW}$package_categories${ENDCOLOR}"
message warn "Type '${GREEN}yes${ENDCOLOR}' and hit [ENTER] to continue"
read -p "=> " continue
if [ "$continue" != "yes" ]
then
message error "Installation aborted."
exit 1
fi
message "Continue with installation..."
2023-06-12 21:43:31 +02:00
message "check sources.list"
if ! grep "contrib" /etc/apt/sources.list > /dev/null && grep "non-free" /etc/apt/sources.list > /dev/null
then
message error "please activate 'contrib' and 'non-free' in your sources.ist"
exit 1
fi
2023-06-12 21:06:54 +02:00
# iterate through $packages
2023-06-12 21:28:56 +02:00
for categorie in $package_categories
2023-06-12 21:06:54 +02:00
do
2023-06-12 21:43:31 +02:00
message "Packages category: ${YELLOW}${categorie}${ENDCOLOR}"
2023-06-12 21:06:54 +02:00
message "Packages contained: "
2023-06-12 21:43:31 +02:00
message "${GREEN}${packages[$categorie]}${ENDCOLOR}"
2023-06-12 21:06:54 +02:00
2023-06-12 21:43:31 +02:00
message "running pre-tasks"
2023-06-12 21:28:56 +02:00
# pre installation steps for categories
case $categorie in
2023-06-12 21:06:54 +02:00
nice)
2023-06-12 21:43:31 +02:00
sudo dpkg --add-architecture i386 || error
sudo apt update || error
2023-06-12 21:06:54 +02:00
;;
esac
2023-06-12 21:28:56 +02:00
2023-06-12 21:43:31 +02:00
message "installing packages"
sudo apt install -y ${packages[$categorie]} || error
message "running post-tasks"
2023-06-12 21:28:56 +02:00
# post installation steps for categories
case $categorie in
base)
2023-06-12 21:51:38 +02:00
sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo || error
;;
gnome)
2023-06-12 22:13:33 +02:00
sudo flatpak install org.mozilla.firefox com.github.GradienceTeam.Gradience || error
2023-06-12 21:28:56 +02:00
;;
esac
2023-06-12 21:06:54 +02:00
done