#! /bin/bash

sudo apt update -y
# install all programms from the install.list
cat install.list | xargs sudo apt-get -y install
# uninstal all programms from the list
cat uninstall.list | xargs sudo apt -y purge
# download additional packages 
cat download.list | xargs sudo wget
# install the packages
sudo apt install -y ./*.deb
# set up flatpack
flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo 
# install languages by ISO 639-1 short
for l in en uk ru ar; do
	sudo apt -y install $(check-language-support -l $l)
done
# import panel settings from file
sudo xfce4-panel-profiles load ./default_panel.tar.bz2
# clean the system
sudo apt update -y
sudo apt full-upgrade -y
sudo apt autoremove -y
sudo apt clean -y 
sudo apt autoclean -y

#set nomacs as default
FILE="/usr/share/applications/momeinfo.cache"
FILETYPES="org.nomacs.ImageLounge.desktop;XnView.desktop;gimp.desktop;simple-image-reducer.desktop;"
for type in png jpg jpeg gif; do
	sudo sed -i "s|^\(image/${type}=\).*|\1${FILETYPES}|" "$FILE"
done
# copy content of desktop_files to desktop
cp -r desktop_files/. $HOME/Schreibtisch

# create skel for new user UI
sudo cp -r /home/$USER/.config/* /etc/skel/
sudo cp -r /home/$USER/.local/* /etc/skel/
sudo cp -r /home/$USER/Schreibtisch/* /etc/skel/Schreibtisch

sudo chown -R root:root /etc/skel
