functions in external files splited in 16.04 and 18.04 versions to prepare next steps

This commit is contained in:
Francois B 2018-05-26 23:25:15 +02:00
parent 80ed0d1b2e
commit 2597a9dd6b
11 changed files with 3511 additions and 5 deletions

655
core_functions_ub1804.sh Normal file
View file

@ -0,0 +1,655 @@
#------------------------------------------------------------------------------#
# Yggdrasil NG #
# compatibility : Mint 18, Ubuntu 16.04, Elementary and other derivatives #
# author : Francois B. (Makotosan/Shakasan) #
# licence : GPLv3 #
# website : https://makotonoblog.be/ #
#------------------------------------------------------------------------------#
#------------------------------------------------------------------------------#
# core functions #
#------------------------------------------------------------------------------#
#
# display a simple message + CR
#
function smsgn () {
printf "$*\n"
}
#
# display a simple message
#
function smsg () {
printf "$*"
}
#
# display a message + notification
#
function msg () {
printf "\n"
printf $JAUNE
if [ "$#" -gt "0" ]; then
printf "$*\n"
/usr/bin/notify-send -t 7000 "$*"
fi
printf $NORMAL
}
#
# display a message between [ ] depending of the ret_code
#
function retCode () {
typeset ret_code="$1"
if [ $ret_code == 0 ]; then
printf "[ "$BOLDVERT"OK"$NORMAL" ] "
else
printf "[ "$BOLDROUGE"!!"$NORMAL" ] "
fi
printf "\n"
}
#
# run a shell command and display a message between [ ] depending on the ret_code
#
function runCmd () {
typeset cmd="$1"
typeset txt="$2"
typeset ret_code
printf "[CMD] $txt "
printf "\n[CMD] $txt : $cmd\n" &>> $logFile
eval $cmd" &>> $logFile"
ret_code=$?
retCode $ret_code
}
#
# display a message + notification + ask to push a key to continue
#
function pressKey () {
printf "$*\n"
if which mpg123 >/dev/null; then
mpg123 -q /opt/yggdrasil/notify.mp3 &
fi
printf $INV
read -p "Press <Enter> key to continue ..."
printf $NORMAL
}
#
# check if OS is Mint
#
function isMint () {
OS=`lsb_release -d | awk -F':' '{print $2}' | awk -F'\t' '{print $2}'`
if [[ $OS == *"Linux Mint 18"* ]]; then
return 0
else
return 1
fi
}
#
# check if DE is Mate
#
function isMate () {
if [[ $DESKTOP_SESSION == *"mate"* ]]; then
return 0
else
return 1
fi
}
#
# check and install required dependencies for Yggdrasil
#
function yggInit () {
typeset ret_code
printf "[INIT]"
runCmd "echo sience-config science-config/group select '$myHomedir ($myHomedir)' | sudo debconf-set-selections" \
"apply settings for science-config pkg"
if ! dpkg --print-foreign-architectures | grep -qi i386; then
printf "[INIT]"
runCmd "sudo dpkg --add-architecture i386" \
"adding i386 architecture"
else
printf "[INIT] i386 architecture already added [ "$BOLDVERT"OK"$NORMAL" ] \n"
fi
printf "[INIT]"
addPPA ppa:ubuntu-desktop/ubuntu-make
printf "[INIT][APT] update "
printf "\n[INIT][APT] update\n" &>> $logFile
sudo apt-get update &>> $logFile
ret_code=$?
retCode $ret_code
printf "[INIT]"
installPackage apt "apt-transport-https"
if ! which umake >/dev/null; then
printf "[INIT][UMAKE] not found, installing...\n"
printf "\n[INIT][UMAKE] not found, installing...\n" &>> $logFile
installPackage apt "ubuntu-make"
else
printf "[INIT][UMAKE] found [ "$BOLDVERT"OK"$NORMAL" ] \n"
fi
if ! which gem >/dev/null; then
printf "[INIT][GEM] not found, installing...\n"
printf "\n[INIT][GEM] not found, installing...\n" &>> $logFile
installPackage apt "ruby-dev"
else
printf "[INIT][GEM] found [ "$BOLDVERT"OK"$NORMAL" ] \n"
fi
if ! which snap >/dev/null; then
printf "[INIT][SNAP] not found, installing...\n"
printf "\n[INIT][SNAP] not found, installing...\n" &>> $logFile
installPackage apt "snapd"
else
printf "[INIT][SNAP] found [ "$BOLDVERT"OK"$NORMAL" ] \n"
fi
if ! which npm >/dev/null; then
printf "[INIT][NPM] not found, installing...\n"
printf "\n[INIT][NPM] not found, installing...\n" &>> $logFile
installPackage apt "nodejs"
else
printf "[INIT][NPM] found [ "$BOLDVERT"OK"$NORMAL" ] \n"
fi
if ! which pip3 >/dev/null; then
printf "[INIT][PIP] not found, installing...\n"
printf "\n[INIT][PIP] not found, installing...\n" &>> $logFile
printf "[INIT]"
installPackage apt "python3-pip"
printf "[INIT]"
installPackage pip "pip"
printf "[INIT]"
installPackage pip "setuptools"
else
printf "[INIT][PIP] found [ "$BOLDVERT"OK"$NORMAL" ] \n"
printf "[INIT]"
installPackage pip "pip"
printf "[INIT]"
installPackage pip "setuptools"
fi
}
#
# update kernel to the latest version
#
function kernelUpdate () {
checkAndInstallDep apt ukuu ukuu \
&& runCmd "sudo ukuu --install-latest --yes" \
"installing latest kernel"
}
#
# system update
#TODO: add pip, npm (yarn?), gem
#
function updateSystem () {
typeset ret_code
printf "[APT] update "
printf "\n[APT] update\n" &>> $logFile
sudo apt-get update &>> $logFile
ret_code=$?
retCode $ret_code
printf "[APT] upgrade "
printf "\n[APT] upgrade\n" &>> $logFile
sudo apt-get -y upgrade &>> $logFile
ret_code=$?
retCode $ret_code
printf "[APT] dist-upgrade "
printf "\n[APT] dist-upgrade\n" &>> $logFile
sudo apt-get -y dist-upgrade &>> $logFile
ret_code=$?
retCode $ret_code
if which snap >/dev/null; then
printf "[SNAP] refresh "
printf "\n[SNAP] refresh\n" &>> $logFile
sudo snap refresh &>> $logFile
ret_code=$?
retCode $ret_code
fi
repoAdded=0
}
#
# add ppa
# input : ppa name
#
function addPPA () {
typeset ret_code
prefix="ppa:"
str="$*"
str2search=${str#$prefix}
if ! grep ^ /etc/apt/sources.list /etc/apt/sources.list.d/* | grep -q ${str2search}; then
printf "[PPA] adding : $* "
printf "\n[PPA] adding $*\n" &>> $logFile
sudo add-apt-repository -y $* &>> $logFile
ret_code=$?
retCode $ret_code
else
printf "[PPA] PPA already added [ "$BOLDVERT"OK"$NORMAL" ] \n"
fi
}
#
# add repo's key
# input : file's url OR keyserver + key
#
function addKey () {
typeset ret_code
case $# in
"1")
printf "[REPO] adding key from file : $1 "
printf "\n[REPO] adding key from file $1\n" &>> $logFile
wget -qO - $1 | sudo apt-key add - &>> $logFile
ret_code=$?
retCode $ret_code
;;
"2")
printf "[REPO] adding key $2 from $1 "
printf "\n[REPO] adding key $2 from $1\n" &>> $logFile
gpg --keyserver $1 --recv-keys $2 &>> $logFile \
&& gpg -a --export $2 | sudo apt-key add - &>> $logFile
ret_code=$?
retCode $ret_code
;;
esac
}
#
# create new entry in /etc/apt/source.list.d/
# input : filename, repo, src repo
#
function addRepo () {
typeset ret_code
printf "[REPO] adding : $2 in $1 "
printf "\n[REPO] adding $2 in $1\n" &>> $logFile
echo $2 | sudo tee /etc/apt/sources.list.d/$1 &>> $logFile
ret_code=$?
retCode $ret_code
if [ "$#" -eq 3 ]; then
printf "[REPO] adding : $3 in $1 "
printf "\n[REPO] adding $3 in $1\n" &>> $logFile
echo $3 | sudo tee -a /etc/apt/sources.list.d/$1 &>> $logFile
ret_code=$?
retCode $ret_code
fi
}
#
# install package manually
# input : url of package, package name, menu mode
#
function installPackageDpkg () {
printf "[PKG] Installing $2 from $1 "
printf "\n[PKG] installing $2 from $1\n" &>> $logFile
cd /tmp \
&& wget -q -O $2 $1 &>> $logFile \
&& sudo dpkg -i $2 &>> $logFile
sudo apt-get install -fy &>> $logFile
ret_code=$?
retCode $ret_code
if [ "$3" == "yes" ]; then
pressKey
fi
}
#
# install package from repositories
# input : package manager, package name
# package manager available : apt, pip, npm, gem, snap
# TODO: add apm, flatpak, umake?, use yarn instead of npm ?
#
function installPackage () {
typeset pkg="$2"
typeset ret_code
case $1 in
"apt")
printf "[APT] Installing $pkg "
printf "\n[APT] installing $pkg\n" &>> $logFile
sudo apt-get install -fy $pkg &>> $logFile
ret_code=$?
retCode $ret_code
;;
"pip")
if which pip3 >/dev/null; then
printf "[PIP] Installing $pkg "
printf "\n[PIP] installing $pkg\n" &>> $logFile
sudo -H pip3 install --upgrade $pkg &>> $logFile
ret_code=$?
retCode $ret_code
fi
;;
"npm")
if which npm >/dev/null; then
printf "[NPM] Installing $pkg "
printf "\n[NPM] installing $pkg\n" &>> $logFile
sudo npm install -g $pkg &>> $logFile
ret_code=$?
retCode $ret_code
fi
;;
"gem")
if which gem >/dev/null; then
printf "[GEM] Installing $pkg "
printf "\n[GEM] installing $pkg\n" &>> $logFile
sudo gem install $pkg &>> $logFile
ret_code=$?
retCode $ret_code
fi
;;
"snap")
if which snap >/dev/null; then
printf "[SNAP] Installing $pkg "
printf "\n[SNAP] installing $pkg\n" &>> $logFile
sudo snap install $pkg --classic &>> $logFile
ret_code=$?
retCode $ret_code
fi
;;
esac
}
#
# check dependency and install it if necessary
# input : package manager, package name, cmd/bin to check
#
function checkAndInstallDep () {
if ! which $3 >/dev/null; then
printf "[DEP] dependency $2 not found [ "$BOLDROUGE"!!"$NORMAL" ]\n"
printf "[DEP] dependency $2 not found\n" &>> $logFile
case $1 in
"apt")
installPackage apt $2
;;
"npm")
installPackage npm $2
;;
"pip")
installPackage pip $2
;;
"gem")
installPackage gem $2
;;
"snap")
installPackage snap $2
;;
esac
fi
}
#
# add specific repository for a given package
# input : unique ID, apt cache update yes/no
#
function addSpecificRepoFct () {
for i in $AppsRepo; do
appRepo=(${i//;/ })
if [ "${appRepo[0]}" == "$1" ]; then
printf "[ADD] package -- $1 -- repo/ppa "
printf "added by function -- ${appRepo[1]}\n"
eval "${appRepo[1]}"
repoAdded=$(($repoAdded+1))
fi
done
if [ "$2" == "yes" ]; then
updateSystem
fi
unset i
unset appRepo
}
#
# find and execute Pre/Post install functions for a specific app
# input : unique ID
#
function processAppTrtFct () {
for i in $AppsTrtFct; do
appTrtFct=(${i//;/ })
if [ "${appTrtFct[0]}" == "$1" ]; then
printf "[TRT] package -- $1 -- "
printf "post install processed by -- ${appTrtFct[1]}\n"
eval "${appTrtFct[1]}"
fi
done
}
#
# install all about a specific category from Apps array app list (headless)
# input : category name
#
function installAppsFromList () {
msg "Installing apps from $1 category"
for i in $Apps; do
app=(${i//;/ })
if [ "${app[2]}" == "$1" ]; then
addSpecificRepoFct ${app[3]}
fi
done
unset i
unset app
if [ "$repoAdded" -gt "0" ]; then
updateSystem
fi
for i in $Apps; do
app=(${i//;/ })
if [ "${app[2]}" == "$1" ]; then
installPackage ${app[1]} ${app[0]}
processAppTrtFct ${app[3]}
fi
done
}
#
# generate install apps menu about a specific category from Apps array app list (Menu)
# input : category name
#
function installAppsFromListMenu () {
for i in $Apps; do
app=(${i//;/ })
if [ "${app[2]}" == "$1" ]; then
list+=("${app[3]}" "${app[3]}" "ON")
fi
done
pkg=$(whiptail \
--title "Yggdrasil $version - App Install ($1)" \
--checklist \
"Select app to install and press OK" 25 80 19 \
"${list[@]}" 3>&1 1>&2 2>&3)
exitstatus=$?
if [ $exitstatus = 0 ]; then
for pkgToInstall in $pkg; do
for i in $Apps; do
app=(${i//;/ })
if [ "${app[3]}" == "${pkgToInstall//\"}" ]; then
addSpecificRepoFct ${app[3]}
fi
done
done
unset i
unset app
unset pkgToInstall
if [ "$repoAdded" -gt "0" ]; then
updateSystem
fi
for pkgToInstall in $pkg; do
for i in $Apps; do
app=(${i//;/ })
if [ "${app[3]}" == "${pkgToInstall//\"}" ]; then
installPackage ${app[1]} ${app[0]}
processAppTrtFct ${app[3]}
fi
done
done
fi
unset list
pressKey
}
#
# create app shortcut
# inputs : bin to exec, icon path, category, name, local/global, start w/ session
#
function createAppShortcut () {
typeset ret_code
shortcut='[Desktop Entry]\n'
shortcut+='Encoding=UTF-8\n'
shortcut+='Terminal=0\n'
shortcut+='Exec='$1'\n'
shortcut+='Icon='$2'\n'
shortcut+='Type=Application\n'
if [ "$6" == "start" ]; then
shortcut+='X-MATE-Autostart-enabled=true\n\n'
else
shortcut+='Categories='$3';\n'
fi
shortcut+='StartupNotify=true\n'
shortcut+='Name='$4'\n'
shortcut+='GenericName='$4'\n'
shortcut+='Comment='
if [ "$5" == "global" ]; then
smsg "creating shortcut for $4 "
echo -e $shortcut > /usr/share/applications/"$4".desktop
ret_code=$?
retCode $ret_code
else
mkdir -p /home/$myHomedir/.local/share/applications
smsg "creating shortcut for $4 "
echo -e $shortcut > /home/"$myHomedir"/.local/share/applications/"$4".desktop
ret_code=$?
retCode $ret_code
fi
}
#
# show Yggdrasil logo
#
function dispLogo () {
printf "\n"
printf $BOLDJAUNE
printf "██╗ ██╗ ██████╗ ██████╗ ██████╗ ██████╗ █████╗ ███████╗██╗██╗ \n"
printf "╚██╗ ██╔╝██╔════╝ ██╔════╝ ██╔══██╗██╔══██╗██╔══██╗██╔════╝██║██║ \n"
printf " ╚████╔╝ ██║ ███╗██║ ███╗██║ ██║██████╔╝███████║███████╗██║██║ \n"
printf " ╚██╔╝ ██║ ██║██║ ██║██║ ██║██╔══██╗██╔══██║╚════██║██║██║ \n"
printf " ██║ ╚██████╔╝╚██████╔╝██████╔╝██║ ██║██║ ██║███████║██║███████╗\n"
printf " ╚═╝ ╚═════╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝╚══════╝\n"
printf "$BOLDROUGE Customize Linux Mint & Ubuntu derivatives made easier\n"
printf "$BOLDBLANC ver "$version" - GPLv3 - Francois B. (Makotosan) - makotonoblog.be\n"
printf "\n"
}
#
# show usage for headless mode
#
function usage () {
dispLogo
dispSysInfos
printf "\n"
printf $NORMAL
printf "Usage : yggdrasil [options]\n\n"
printf " "$BOLDVERT"-f"$NORMAL" : install everything (see man pages for more details)(a+c+d+q)\n"
printf " "$BOLDVERT"-a"$NORMAL" : install all apps\n"
printf " "$BOLDVERT"-c"$NORMAL" : install Themes and Icons\n"
printf " "$BOLDVERT"-w"$NORMAL" : install Nitrogen + remove desktop management from caja\n"
printf " "$BOLDVERT"-d"$NORMAL" : install DNS Cache Unbound\n"
printf " "$BOLDVERT"-q"$NORMAL" : install cardreader apps\n"
printf " "$BOLDVERT"-s"$NORMAL" : install Solaar for Logitech Unifying devices\n"
printf " "$BOLDVERT"-t"$NORMAL" : install TLP for Laptops and low energy usage\n"
printf " "$BOLDVERT"-n"$NORMAL" : install lastest Nvidia graphic drivers\n"
printf " "$BOLDVERT"-g"$NORMAL" : install lastest free graphic drivers (nouveau, amdgpu, ati, intel), mesa, ...\n"
printf " "$BOLDVERT"-k"$NORMAL" : update system to the latest kernel\n"
printf " "$BOLDVERT"-u"$NORMAL" : update system (apt,snap,...)\n"
printf " "$BOLDVERT"-p"$NORMAL" : clean useless packages\n"
printf " "$BOLDVERT"-v"$NORMAL" : show verison number\n"
printf " "$BOLDVERT"-h"$NORMAL" : show help & informations\n"
printf "\n"
}
function dispSysInfos () {
# CPU Architecture
printf $BOLDVERT"Architecture : "$NORMAL
uname -m
# Current user homedir
printf $BOLDVERT"User (userdir) :"$NORMAL" $myHomedir\n"
# Linux Distro Name
printf $BOLDVERT"OS : "$NORMAL
lsb_release -d | awk -F':' '{print $2}' | awk -F'\t' '{print $2}'
# Kernel version
printf $BOLDVERT"Kernel : "$NORMAL
uname -r
# Desktop Name
printf $BOLDVERT"Desktop : "$NORMAL
case $XDG_CURRENT_DESKTOP in
"ENLIGHTENMENT")
printf "Enlightenment"
printf "\n"
;;
"GNOME")
printf "Gnome"
printf "\n"
;;
"KDE")
printf "KDE"
printf "\n"
;;
"LXDE")
printf "LXDE"
printf "\n"
;;
"MATE")
printf "Mate"
printf "\n"
;;
"XFCE")
printf "XFCE"
printf "\n"
;;
"X-Cinnamon")
printf "Cinnamon"
printf "\n"
;;
"Unity")
printf "Unity"
printf "\n"
;;
esac
# Screen Resolution
printf $BOLDVERT"Screen resolution : "$NORMAL
xdpyinfo | sed -n 's/.*dim.* \([0-9]*x[0-9]*\) .*/\1/pg' | tr '\n' ' '
printf "\n"
# Type of Shell
printf $BOLDVERT"Shell : "$NORMAL
shellType=$(ps -p $PPID -o cmd --no-heading)
shellType=${shellType/-}
shellType=${shellType//*\/}
printf $shellType"\n"
}

900
install_functions_ub1804.sh Normal file
View file

@ -0,0 +1,900 @@
#------------------------------------------------------------------------------#
# Yggdrasil NG #
# compatibility : Mint 18, Ubuntu 16.04, Elementary and other derivatives #
# author : Francois B. (Makotosan/Shakasan) #
# licence : GPLv3 #
# website : https://makotonoblog.be/ #
#------------------------------------------------------------------------------#
#-----------------------------------------------------------------------------#
# install functions #
#-----------------------------------------------------------------------------#
#
# install Base Apps (headless)
#
function installBase () {
installAppsFromList base
}
#
# install Base Apps (Menu)
#
function installBaseMenu () {
installAppsFromListMenu base
}
#
# install Office Apps (headless)
#
function installOffice () {
installAppsFromList office
}
#
# install Office Apps (Menu)
#
function installOfficeMenu () {
installAppsFromListMenu office
}
#
# install Multimedia Apps (headless)
#
function installMultimedia () {
installAppsFromList multimedia
}
#
# install Multimedia Apps (Menu)
#
function installMultimediaMenu () {
installAppsFromListMenu multimedia
}
#
# install eBook Apps (headless)
#
function installEbook () {
installAppsFromList ebook
}
#
# install eBook Apps (Menu)
#
function installEbookMenu () {
installAppsFromListMenu ebook
}
#
# install Internet Apps (headless)
#
function installInternet () {
runCmd "echo opera-stable opera-stable/add-deb-source boolean false | sudo debconf-set-selections" \
"setting as do not add repo"
installAppsFromList internet
}
#
# install Internet Apps (Menu)
#
function installInternetMenu () {
runCmd "echo opera-stable opera-stable/add-deb-source boolean false | sudo debconf-set-selections" \
"setting as do not add repo"
installAppsFromListMenu internet
}
#
# Viber (headless)
#
function installViber () {
installPackageDpkg http://download.cdn.viber.com/cdn/desktop/Linux/viber.deb \
viber.deb \
no
}
#
# Viber (Menu)
#
function installViberMenu () {
installPackageDpkg http://download.cdn.viber.com/cdn/desktop/Linux/viber.deb \
viber.deb \
yes
}
#
# Franz (headless)
#
function installFranz () {
installPackageDpkg https://github.com/meetfranz/franz/releases/download/v5.0.0-beta.17/franz_5.0.0-beta.17_amd64.deb \
franz.deb \
no
}
#
# Franz (Menu)
#
function installFranzMenu () {
installPackageDpkg https://github.com/meetfranz/franz/releases/download/v5.0.0-beta.17/franz_5.0.0-beta.17_amd64.deb \
franz.deb \
yes
}
#
# install Misc Utilities Apps (headless)
#
function installMiscUtilities () {
installAppsFromList utilities
}
#
# install Misc Utilities Apps (Menu)
#
function installMiscUtilitiesMenu () {
installAppsFromListMenu utilities
}
#
# install Wine Build (headless)
#
function installWine () {
installAppsFromList wine
}
#
# install Wine Build (Menu)
#
function installWineMenu () {
installAppsFromListMenu wine
}
#
# install Game Apps (headless)
#
function installGames () {
installAppsFromList games
}
#
# install Game Apps (Menu)
#
function installGamesMenu () {
installAppsFromListMenu games
}
#
# Steam (headless)
#
function installSteam () {
runCmd "echo steam steam/purge \"note\" | sudo debconf-set-selections \"accepting steam licence\""
runCmd "echo steam steam/license \"note\" | sudo debconf-set-selections \"accepting steam licence 2/3\""
runCmd "echo steam steam/question select \"I AGREE\" | sudo debconf-set-selections \"accepting steam licence 3/3\""
installPackage apt steam
}
#
# Steam (Menu)
#
function installSteamMenu () {
installPackage apt steam
}
#
# install Burning Apps (headless)
#
function installBurningTools () {
installAppsFromList burningtools
}
#
# install Burning Apps (Menu)
#
function installBurningToolsMenu () {
installAppsFromListMenu burningtools
}
#
# install Network Apps (headless)
#
function installNetTools () {
runCmd "echo wireshark-common wireshark-common/install-setuid boolean true | sudo debconf-set-selections" \
"setting Wireshark as root only"
installAppsFromList nettools
}
#
# install Network Apps (Menu)
#
function installNetToolsMenu () {
runCmd "echo wireshark-common wireshark-common/install-setuid boolean true | sudo debconf-set-selections" \
"setting Wireshark as root only"
installAppsFromListMenu nettools
}
#
# install Caja Plugins (headless)
#
function installCajaPlugins () {
installAppsFromList cajaplugins
}
#
# install Caja Plugins (Menu)
#
function installCajaPluginsMenu () {
installAppsFromListMenu cajaplugins
}
#
# install Nautilus Apps + plugins (headless)
#
function installNautilusAndPlugins () {
installAppsFromList nautilus
}
#
# install Nautilus Apps + plugins (Menu)
#
function installNautilusAndPluginsMenu () {
installAppsFromListMenu nautilus
}
#
# install Gimp plugins (headless)
#
function installGimpPlugins () {
installAppsFromList gimp
}
#
# install Gimp plugins (Menu)
#
function installGimpPluginsMenu () {
installAppsFromListMenu gimp
}
#
# install RhythmBox plugins (headless)
#
function installRhythmBoxPlugins () {
installAppsFromList rhythmbox
}
#
# install RhythmBox plugins (Menu)
#
function installRhythmBoxPluginsMenu () {
installAppsFromListMenu rhythmbox
}
#
# install Pidgin plugins (headless)
#
function installPidginPlugins () {
installAppsFromList pidgin
}
#
# install Pidgin plugins (Menu)
#
function installPidginPluginsMenu () {
installAppsFromListMenu pidgin
}
#
# install Nitrogen app (headless)
#
function installNitrogen () {
installAppsFromList nitrogen
}
#
# install Nitrogen app (Menu)
#
function installNitrogenMenu () {
installAppsFromListMenu nitrogen
}
#
# install Beta Apps (headless)
#
function installBeta () {
installAppsFromList beta
}
#
# install Beta Apps (Menu)
#
function installBetaMenu () {
installAppsFromListMenu beta
}
#
# install Nightly Apps (headless)
#
function installNightly () {
installAppsFromList nightly
}
#
# install Nightly Apps (Menu)
#
function installNightlyMenu () {
installAppsFromListMenu nightly
}
#
# install GTK Themes (headless)
#
function installThemes () {
installAppsFromList gtkthemes
}
#
# install GTK Themes (Menu)
#
function installThemesMenu () {
installAppsFromListMenu gtkthemes
}
#
# install Icon Themes (headless)
#
function installIcons () {
installAppsFromList icons
}
#
# install Icon Themes (Menu)
#
function installIconsMenu () {
installAppsFromListMenu icons
}
#
# install Solaar App (headless)
#
function installSolaar () {
installAppsFromList solaar
}
#
# install Solaar App (Menu)
#
function installSolaarMenu () {
installAppsFromListMenu solaar
}
#
# install CardReader Apps (headless)
#
function installCardReader () {
installAppsFromList cardreader
}
#
# install CardReader Apps (Menu)
#
function installCardReaderMenu () {
installAppsFromListMenu cardreader
}
#
# update AMD/Intel CPU Microcode
#
function updateMicrocode () {
msg "CPU Microcode updating"
oldMicrocode=`cat /proc/cpuinfo | grep -i --color microcode -m 1`
intel=`cat /proc/cpuinfo | grep -i Intel | wc -l`
amd=`cat /proc/cpuinfo | grep -i Amd | wc -l`
if [ "$intel" -gt "0" ]; then
printf "[INFO] Microcode updated from "$oldMicrocode" version to "$newMicrocode" version"
installPackage apt intel-microcode
elif [ "$amd" -gt "0" ]; then
installPackage apt amd64-microcode
printf "[INFO] Microcode updated from "$oldMicrocode" version to "$newMicrocode" version"
else
printf "[INFO] No Intel/AMD CPU found"
fi
newMicrocode=`cat /proc/cpuinfo | grep -i --color microcode -m 1`
printf "\n"
}
#
# fix some config issue with Intel Wireless 6320 cards
#
function fixWirelessIntel6320 () {
runCmd "sudo cp /etc/modprobe.d/iwlwifi.conf /etc/modprobe.d/iwlwifi.conf.bak" \
"backing up config file"
runCmd "echo options iwlwifi bt_coex_active=0 swcrypto=1 11n_disable=8 | sudo tee /etc/modprobe.d/iwlwifi.conf" \
"applying new config"
printf "[INFO] reboot required !!!"
printf "\n"
}
#
# install Webcam Apps (headless)
#
function installWebcam () {
installAppsFromList webcam
}
#
# install Webcam Apps (Menu)
#
function installWebcamMenu () {
installAppsFromListMenu webcam
}
#
# install latest versions of graphic drivers, mesa, .... (headless)
#
function installOibaf () {
addRepo_Oibaf
}
#
# install latest versions of graphic drivers, mesa, .... (Menu)
#
function installOibafMenu () {
addRepo_Oibaf
}
#
# install Nvidia Drivers (headless)
#
function installNvidia370 () {
installAppsFromList nvidia-370
}
#
# install Nvidia Drivers (Menu)
#
function installNvidia370Menu () {
installAppsFromListMenu nvidia-370
}
#
# install Nvidia Drivers (headless)
#
function installNvidia375 () {
installAppsFromList nvidia-375
}
#
# install Nvidia Drivers (Menu)
#
function installNvidia375Menu () {
installAppsFromListMenu nvidia-375
}
#
# install Nvidia Drivers (headless)
#
function installNvidia378 () {
installAppsFromList nvidia-378
}
#
# install Nvidia Drivers (Menu)
#
function installNvidia378Menu () {
installAppsFromListMenu nvidia-378
}
#
# install Nvidia Drivers (headless)
#
function installNvidia381 () {
installAppsFromList nvidia-381
}
#
# install Nvidia Drivers (Menu)
#
function installNvidia381Menu () {
installAppsFromListMenu nvidia-381
}
#
# install Nvidia Drivers (headless)
#
function installNvidia384 () {
installAppsFromList nvidia-384
}
#
# install Nvidia Drivers (Menu)
#
function installNvidia384Menu () {
installAppsFromListMenu nvidia-384
}
#
# install Nvidia Drivers (headless)
#
function installNvidia387 () {
installAppsFromList nvidia-387
}
#
# install Nvidia Drivers (Menu)
#
function installNvidia387Menu () {
installAppsFromListMenu nvidia-387
}
#
# install Nvidia Drivers (headless)
#
function installNvidia390 () {
installAppsFromList nvidia-390
}
#
# install Nvidia Drivers (Menu)
#
function installNvidia390Menu () {
installAppsFromListMenu nvidia-390
}
#
# install Nvidia Drivers (headless)
#
function installNvidia396 () {
installAppsFromList nvidia-396
}
#
# install Nvidia Drivers (Menu)
#
function installNvidia396Menu () {
installAppsFromListMenu nvidia-396
}
#
# install TLP App (headless)
#
function installTLP () {
installAppsFromList tlp
}
#
# install TLP App (Menu)
#
function installTLPMenu () {
installAppsFromListMenu tlp
}
#TODO:
function installKeyIDuDev () {
sudo sh -c "echo '# this udev file should be used with udev 188 and newer\n\
ACTION!=\"add|change\", GOTO=\"u2f_end\"\n\
\n\
# Key-ID FIDO U2F\n\
KERNEL==\"hidraw*\", SUBSYSTEM==\"hidraw\", ATTRS{idVendor}==\"096e\", ATTRS{idProduct}==\"0850|0880\", TAG+=\"uaccess\"\n\
\n\
LABEL=\"u2f_end\"' > /etc/udev/rules.d/70-u2f.rules"
runCmd "sudo service udev restart" \
"restarting UDEV service"
}
#
# install Dev Apps (headless)
#
function installDevApps () {
installAppsFromList dev
}
#
# install Dev Apps (Menu)
#
function installDevAppsMenu () {
installAppsFromListMenu dev
}
#
# install Javascript env (headless)
#
function installJavascript () {
installAppsFromList javascript
}
#
# install Javascript env (Menu)
#
function installJavascriptMenu () {
installAppsFromListMenu javascript
}
#
# install JAVA 10 (headless)
#
function installJava10 () {
runCmd "echo oracle-java10-installer shared/accepted-oracle-license-v1-1 select true | sudo debconf-set-selections" \
"accepting Oracle Java SE 10 licence agreement"
installAppsFromList java10
}
#
# install JAVA 10 (Menu)
#
function installJava10Menu () {
runCmd "echo oracle-java10-installer shared/accepted-oracle-license-v1-1 select true | sudo debconf-set-selections" \
"accepting Oracle Java SE 10 licence agreement"
installAppsFromListMenu java10
}
#
# install Mongo DB 3 CE (headless)
#
function installMongo3CE () {
installAppsFromList mongodb
}
#
# install Mongo DB 3 CE (Menu)
#
function installMongo3CEMenu () {
installAppsFromListMenu mongodb
}
#
# install Python Apps (headless)
#
function installPython () {
installAppsFromList python
}
#
# install Python Apps (Menu)
#
function installPythonMenu () {
installAppsFromListMenu python
}
#
# install PHP Apps (headless)
#
function installPHP () {
installAppsFromList php
}
#
# install PHP Apps (Menu)
#
function installPHPMenu () {
installAppsFromListMenu php
}
#
# install QT Apps/tools (headless)
#
function installQT () {
installAppsFromList qt
}
#
# install QT Apps/tools (Menu)
#
function installQTMenu () {
installAppsFromListMenu qt
}
#
# install LUA Apps (headless)
#
function installLUA () {
installAppsFromList lua
}
#
# install LUA Apps (Menu)
#
function installLUAMenu () {
installAppsFromListMenu lua
}
#
# install Ruby Apps (headless)
#
function installRuby () {
installAppsFromList ruby
}
#
# install Ruby Apps (Menu)
#
function installRubyMenu () {
installAppsFromListMenu ruby
}
#TODO:
function installAndroidEnv () {
msg="Installing Android environment"
runCmd "touch /home/$myHomedir/.bashrc" \
"creating .bashrc file if necessary"
sh -c "echo '\n\nexport PATH=${PATH}:/home/'$myHomedir'/Android/Sdk/tools:/home/'$myHomedir'/Android/Sdk/platform-tools' >> /home/$myHomedir/.bashrc"
}
#
# install Atom App (headless)
#
function installAtom () {
installAppsFromList atom
}
#
# install Atom App (menu)
#
function installAtomMenu () {
installAppsFromListMenu atom
}
#
# install Anjuta Apps (headless)
#
function installAnjuta () {
installAppsFromList anjuta
}
#
# install Anjuta Apps (Menu)
#
function installAnjutaMenu () {
installAppsFromListMenu anjuta
}
#
# install Brackets Apps (headless)
#
function installBrackets () {
installAppsFromList brackets
}
#
# install Brackets Apps (Menu)
#
function installBracketsMenu () {
installAppsFromListMenu brackets
}
#
# install CodeBlocks Apps (headless)
#
function installCodeBlocks () {
installAppsFromList codeblocks
}
#
# install CodeBlocks Apps (Menu)
#
function installCodeBlocksMenu () {
installAppsFromListMenu codeblocks
}
#
# install Geany Apps (headless)
#
function installGeany () {
installAppsFromList geany
}
#
# install Geany Apps (Menu)
#
function installGeanyMenu () {
installAppsFromListMenu geany
}
#
# install IDEA Apps (headless)
#
function installIdea () {
installAppsFromList idea
}
#
# install IDEA Apps (Menu)
#
function installIdeaMenu () {
installAppsFromListMenu idea
}
#
# install Pycharm Apps (headless)
#
function installPyCharm () {
installAppsFromList pycharm
}
#
# install Pycharm Apps (Menu)
#
function installPyCharmMenu () {
installAppsFromListMenu pycharm
}
#
# install Visual Studio Code Apps (headless)
#
function installVisualStudioCode () {
installAppsFromList code
}
#
# install Visual Studio Code Apps (Menu)
#
function installVisualStudioCodeMenu () {
installAppsFromListMenu code
}
#
# install Android-Studio Apps (headless)
#
function installAndroidStudio () {
installAppsFromList androidstudio
}
#
# install Android-Studio Apps (Menu)
#
function installAndroidStudioMenu () {
installAppsFromListMenu androidstudio
}
#
# install SublimeText Apps (headless)
#
function installSublimeText() {
installAppsFromList sublime-text
}
#
# install SublimeText Apps (Menu)
#
function installSublimeTextMenu() {
installAppsFromListMenu sublime-text
}
#
# install CAD Apps (headless)
#
function installCAD () {
installAppsFromList cad
}
#
# install CAD Apps (Menu)
#
function installCADMenu () {
installAppsFromListMenu cad
}
#
# install Teamviewer 13 (headless)
#
function installTeamViewer13 () {
installPackageDpkg https://download.teamviewer.com/download/linux/teamviewer_amd64.deb \
teamviewer13.deb \
no
}
#
# install Teamviewer 13 (Menu)
#
function installTeamViewer13Menu () {
installPackageDpkg https://download.teamviewer.com/download/linux/teamviewer_amd64.deb \
teamviewer13.deb \
yes
}
#
# install/enable Unboud (headless)
#
function installUnbound () {
installAppsFromList unbound
}

475
menus_functions_ub1804.sh Normal file
View file

@ -0,0 +1,475 @@
#------------------------------------------------------------------------------#
# Yggdrasil NG #
# compatibility : Mint 18, Ubuntu 16.04, Elementary and other derivatives #
# author : Francois B. (Makotosan/Shakasan) #
# licence : GPLv3 #
# website : https://makotonoblog.be/ #
#------------------------------------------------------------------------------#
#-----------------------------------------------------------------------------#
# menus functions #
#-----------------------------------------------------------------------------#
#
# show about dialog box
#
function showAboutBoxMenu () {
whiptail \
--title "About" \
--msgbox "\n
Author : Francois B. (Makotosan)
Email : shakasan@sirenacorp.be
Website : https://makotonoblog.be/
Github : https://github.com/shakasan/yggdrasil_ng
Licence : GPLv3
Version : $version\n
At the beginning, this script has been written to makes my life easier when I have to (re)install my personal computers ;-)
Advices and remarks are welcome ^^" \
20 80
}
#
# show reboot menu
#
function showRebootBoxMenu () {
if (whiptail \
--title "Yggdrasil $version - WARNING - ReBoot" \
--yesno "Are you sure to reboot this computer ?" \
7 42) then
sudo reboot
fi
}
#
# show menu to config system
#
function showConfigMenu () {
while true; do
configMenuOptions=$(whiptail \
--title "Yggdrasil $version - System Config" \
--menu "System Config" \
25 80 16 \
"Ufw" "Enable Firewall (ufw)" \
"NumLockX" "NumLock Enabled at boot time" \
"TmpRAM" "/tmp stored in RAM" \
"screenfetch" "screenfetch added to .bashrc" \
"historyTS" "TimeStamp enabled in Shell History" \
"unattendedUpgrades" "Enable automatic security updates" \
"Unbound" "Enable Unbound DNS Cache server" \
"Back" "Back" 3>&1 1>&2 2>&3)
case $configMenuOptions in
"Ufw")
clear
enableUFW
pressKey
;;
"NumLockX")
clear
enableNumLockX
pressKey
;;
"TmpRAM")
clear
enableTmpRAM
pressKey
;;
"screenfetch")
clear
addScreenfetchBashrc
pressKey
;;
"historyTS")
clear
enableHistoryTS
pressKey
;;
"unattendedUpgrades")
clear
installUnattendedUpgrades
pressKey
;;
"Unbound")
clear
installUnbound
pressKey
;;
"Back")
break
;;
esac
done
}
#
# show menu to install system tools
#
function showSysToolsMenu () {
while true; do
sysToolsMenuOptions=$(whiptail \
--title "Yggdrasil $version - System Tools" \
--menu "System tools to diagnose and optimize" \
25 80 16 \
"inxi" "System informations" \
"speedtest-cli" "Bandwidth test" \
"packetloss" "Packetloss test (ping)" \
"OptimizeFirefox" "Firefox SQLite databases optimization" \
"Autoremove" "Remove useless Deb packages" \
"CleanOldKernels" "Removing old kernels (keep 2 last kernels)" \
"SoundCardsDetection" "Sound Cards Detection" \
"Back" "Back" 3>&1 1>&2 2>&3)
case $sysToolsMenuOptions in
"inxi")
clear; toolInxi; pressKey
;;
"speedtest-cli")
clear; toolSpeedtestCli; pressKey
;;
"packetloss")
clear; toolPacketLoss; pressKey
;;
"OptimizeFirefox")
clear; toolOptimizeFirefox; pressKey
;;
"Autoremove")
clear; toolAutoremove; pressKey
;;
"CleanOldKernels")
clear; toolClearOldKernels; pressKey
;;
"SoundCardsDetection")
clear; toolSoundCardsDetection; pressKey
;;
"Back")
break
;;
esac
done
}
#
# show menu to install themes/icons
#
function showThemesInstallMenu () {
while true; do
themesInstallMenuOptions=$(whiptail \
--title "Yggdrasil $version - Themes/Icons Install" \
--menu "Install themes/icons from different submenus" \
25 80 16 \
"themes" "GTK themes" \
"icons" "Icons" \
"Back" "Back" 3>&1 1>&2 2>&3)
case $themesInstallMenuOptions in
"themes")
installThemesMenu
;;
"icons")
installIconsMenu
;;
"Back")
break
;;
esac
done
}
#
# show menu to install dev apps
#
function showDevInstallMenu () {
while true; do
devInstallMenuOptions=$(whiptail \
--title "Yggdrasil $version - Dev Install" \
--menu "Install Dev apps from different submenus" \
25 80 16 \
"devbase" "dev apps and tools" \
"java10" "Java 10 dev env" \
"javascript" "JavaScript dev env" \
"mongodb3ce" "MongoDB 3 CE" \
"php" "PHP dev env" \
"lua" "Lua dev env" \
"ruby" "Ruby dev env" \
"qt" "QT dev env" \
"python" "Python dev env" \
"atom" "Atom" \
"anjuta" "Anjuta" \
"brackets" "Brackets" \
"codeblocks" "CodeBlocks" \
"geany" "Geany" \
"idea" "Idea" \
"pycharm" "PyCharm" \
"vsc" "Visual Studio Code" \
"androidstudio" "Android Studio" \
"sublimetext" "Sublime Text" \
"cad" "CAD tools" \
"teamviewer13" "Teamviewer 13" \
"Back" "Back" 3>&1 1>&2 2>&3)
case $devInstallMenuOptions in
"devbase")
installDevAppsMenu
;;
"java10")
installJava10
;;
"javascript")
installJavascriptMenu
;;
"mongodb3ce")
installMongo3CEMenu
;;
"php")
installPHPMenu
;;
"lua")
installLUAMenu
;;
"ruby")
installRubyMenu
;;
"qt")
installQTMenu
;;
"python")
installPythonMenu
;;
"atom")
installAtomMenu
;;
"anjuta")
installAnjutaMenu
;;
"brackets")
installBracketsMenu
;;
"codeblocks")
installCodeBlocksMenu
;;
"geany")
installGeanyMenu
;;
"idea")
installIdeaMenu
;;
"pycharm")
installPyCharmMenu
;;
"vsc")
installVisualStudioCodeMenu
;;
"androidstudio")
installAndroidStudioMenu
;;
"sublimetext")
installSublimeTextMenu
;;
"cad")
installCADMenu
;;
"teamviewer13")
installTeamViewer13Menu
;;
"Back")
break
;;
esac
done
}
#
# show menu to install apps from different categories
#
function showAppInstallMenu () {
while true; do
appsInstallMenuOptions=$(whiptail \
--title "Yggdrasil $version - Apps Install" \
--menu "Install apps from different submenus" \
25 80 16 \
"base" "Base Apps" \
"office" "Office Apps" \
"multimedia" "Multimedia Apps" \
"internet" "Internet Apps" \
"utilities" "Misc Utilities" \
"games" "Games & tools" \
"steam" "Steam" \
"burningtools" "Disc Burning and tools" \
"nettools" "Network tools" \
"cajaplugins" "Caja Plugins" \
"nautilus" "Nautilus and plugins" \
"gimp" "Gimp plugins" \
"rhythmbox" "RhythmBox plugins" \
"pidgin" "Pidgin plugins" \
"nitrogen" "Nitrogen WP Manager" \
"wine" "Wine Builds" \
"viber" "Viber IM desktop app" \
"Back" "Back" 3>&1 1>&2 2>&3)
case $appsInstallMenuOptions in
"base")
installBaseMenu
;;
"office")
installOfficeMenu
;;
"multimedia")
installMultimediaMenu
;;
"internet")
installInternetMenu
;;
"utilities")
installMiscUtilitiesMenu
;;
"games")
installGamesMenu
;;
"steam")
installSteamMenu
;;
"burningtools")
installBurningToolsMenu
;;
"nettools")
installNetToolsMenu
;;
"cajaplugins")
installCajaPluginsMenu
;;
"nautilus")
installNautilusAndPluginsMenu
;;
"gimp")
installGimpPluginsMenu
;;
"rhythmbox")
installRhythmBoxPluginsMenu
;;
"pidgin")
installPidginPluginsMenu
;;
"nitrogen")
installNitrogenMenu
;;
"wine")
installWineMenu
;;
"viber")
installViberMenu
;;
"Back")
break
;;
esac
done
}
#
# show menu to install beta apps from different categories
#
function showAppBetaInstallMenu () {
installBetaMenu
}
#
# show menu to install nightly apps from different categories
#
function showAppNightlyInstallMenu () {
installNightlyMenu
}
#
# show menu about install/config hardware
#
function showHardwareMenu () {
while true; do
hardwareMenuOptions=$(whiptail \
--title "Yggdrasil $version - System Tools" \
--menu "System tools to diagnose and optimize" \
25 80 16 \
"cardreader" "Apps/tools needed for cardreaders" \
"solaar" "Solaar for Logitech Unifying devices" \
"webcam" "Install webcam neede apps" \
"microcode" "Update Intel/AMD CPU microcode" \
"oibaf" "latest version of free graphic drivers, mesa, ..." \
"nvidia370" "Install Nvidia 370 graphic drivers" \
"nvidia375" "Install Nvidia 375 graphic drivers" \
"nvidia378" "Install Nvidia 378 graphic drivers" \
"nvidia381" "Install Nvidia 381 graphic drivers" \
"nvidia384" "Install Nvidia 384 graphic drivers" \
"nvidia387" "Install Nvidia 387 graphic drivers" \
"nvidia390" "Install Nvidia 390 graphic drivers" \
"nvidia396" "Install Nvidia 396 graphic drivers" \
"tlp" "Install/Enable TLP for better power management " \
"keyid" "Add udev rules for Key-ID FIDO U2F usb key" \
"WI6320" "Fix Intel Wireless 6320 card config problem" \
"Back" "Back" 3>&1 1>&2 2>&3)
case $hardwareMenuOptions in
"cardreader")
installCardReaderMenu
;;
"solaar")
installAppsFromListMenu
;;
"webcam")
installWebcamMenu
;;
"microcode")
updateMicrocode
;;
"oibaf")
installOibafMenu
;;
"nvidia370")
installNvidia370Menu
;;
"nvidia375")
installNvidia375Menu
;;
"nvidia378")
installNvidia378Menu
;;
"nvidia381")
installNvidia381Menu
;;
"nvidia384")
installNvidia384Menu
;;
"nvidia387")
installNvidia387Menu
;;
"nvidia390")
installNvidia390Menu
;;
"nvidia396")
installNvidia396Menu
;;
"tlp")
installTLPMenu
;;
"keyid")
installKeyIDuDev
;;
"WI6320")
fixWirelessIntel6320
;;
"Back")
break
;;
esac
done
}

1319
repo_functions_ub1804.sh Normal file

File diff suppressed because it is too large Load diff

145
tools_functions_ub1804.sh Normal file
View file

@ -0,0 +1,145 @@
#------------------------------------------------------------------------------#
# Yggdrasil NG #
# compatibility : Mint 18, Ubuntu 16.04, Elementary and other derivatives #
# author : Francois B. (Makotosan/Shakasan) #
# licence : GPLv3 #
# website : https://makotonoblog.be/ #
#------------------------------------------------------------------------------#
#-----------------------------------------------------------------------------#
# tools and config functions #
#-----------------------------------------------------------------------------#
#
# enable ufw at boot time and add rules for installed apps
#
function enableUFW () {
runCmd "sudo ufw enable"\
"enabling UFW at boot"
if which syncthing >/dev/null; then
runCmd "sudo ufw allow syncthing" \
"adding UFW rules for Syncthing"
fi
}
#
# enable numlock by default on LightDM
#
function enableNumLockX () {
checkAndInstallDep apt numlockx numlockx
if which lightdm >/dev/null; then
runCmd "sudo cp /etc/lightdm/lightdm.conf.d/70-linuxmint.conf /etc/lightdm/lightdm.conf.d/70-linuxmint.conf.yggbak" \
"backing up lightdm original config file"
runCmd "echo -e '\ngreeter-setup-script=/usr/bin/numlockx on' | sudo tee -a /etc/lightdm/lightdm.conf.d/70-linuxmint.conf" \
"enabling numlockx on in lightdm at boot"
fi
}
#
# /tmp in RAM by modifying /etc/fstab
#TODO: add possibily to choose amount of ram
function enableTmpRAM () {
runCmd "echo 'tmpfs /tmp tmpfs defaults,size=2g 0 0' | sudo tee -a /etc/fstab" \
"enabling /tmp in RAM by modifying /etc/fstab"
if (whiptail --title "/tmp in RAM - Reboot" --yesno "Reboot required, proceed now ?" 10 60) then
sudo reboot
fi
}
#
# add screenfetch exec in .bashrc
#
function addScreenfetchBashrc () {
checkAndInstallDep apt screenfetch screenfetch
runCmd "touch /home/$myHomedir/.bashrc" \
"creating .bashrc file if necessary" \
runCmd "echo 'screenfetch -t' | tee -a /home/$myHomedir/.bashrc" \
"adding screenfetch to .bashrc"
}
#
# cli history cmd timestamp enable
#
function enableHistoryTS () {
typeset ret_code
printf "enabling CLI History TimeStamp "
echo "export HISTTIMEFORMAT='%F %T '" | tee -a /home/$myHomedir/.bashrc &>> $logFile
ret_code=$?
retCode $ret_code
}
#
# install/enable auto install of security updates
#
function installUnattendedUpgrades () {
installPackage apt unattended-upgrades
}
#
# display useful system/hardware informations
#
function toolInxi () {
checkAndInstallDep apt inxi inxi \
&& inxi -F
}
#
# check bandwith and latency of the internet connection
#
function toolSpeedtestCli () {
checkAndInstallDep pip speedtest-cli speedtest-cli \
&& speedtest-cli
}
#
# check for packet loss
#
function toolPacketLoss () {
ping -q -c 10 google.com
}
#
# Optimization of SQLite databases of Firefox and Firefox Nightly
#
function toolOptimizeFirefox () {
if (whiptail --title "Firefox SQLite DB Optimization" --yesno "Terminate Firefox and proceed ?" 10 60) then
if which firefox >/dev/null; then
printf "Optimizing Firefox"
pkill -9 firefox
for f in ~/.mozilla/firefox/*/*.sqlite; do sqlite3 $f 'VACUUM; REINDEX;'; done
printf "\n"
fi
if which firefox-trunk >/dev/null; then
printf "Optimizing Firefox Nightly"
pkill -9 firefox-trunk
for f in ~/.mozilla/firefox-trunk/*/*.sqlite; do sqlite3 $f 'VACUUM; REINDEX;'; done
printf "\n"
fi
fi
}
#
# remove useless packages (depedencies)
#
function toolAutoremove () {
runCmd "sudo apt-get -y autoremove" \
"removing not necessary dependencies"
}
#
# remove old versions of installed kernels
#
function toolClearOldKernels () {
checkAndInstallDep apt ukuu ukuu \
&& runCmd "sudo ukuu --purge-old-kernels --yes" \
"removing old kernels"
}
#
# force soundcards detection
#
function toolSoundCardsDetection () {
runCmd "sudo alsa force-reload" \
"detecting ALSA sound cards"
}

View file

@ -12,11 +12,23 @@
#
dir=$(dirname $0)
source /opt/yggdrasil/vars.sh
source /opt/yggdrasil/core_functions.sh
source /opt/yggdrasil/repo_functions.sh
source /opt/yggdrasil/install_functions.sh
source /opt/yggdrasil/menus_functions.sh
source /opt/yggdrasil/tools_functions.sh
OS=`lsb_release -d | awk -F':' '{print $2}' | awk -F'\t' '{print $2}'`
if [[ $OS == *"Linux Mint 18"* ]]; then
source /opt/yggdrasil/core_functions_ub1604.sh
source /opt/yggdrasil/repo_functions_ub1604.sh
source /opt/yggdrasil/install_functions_ub1604.sh
source /opt/yggdrasil/menus_functions_ub1604.sh
source /opt/yggdrasil/tools_functions_ub1604.sh
elif [[ $OS == *"Ubuntu 18.04 LTS"* ]]; then
source /opt/yggdrasil/core_functions_ub1804.sh
source /opt/yggdrasil/repo_functions_ub1804.sh
source /opt/yggdrasil/install_functions_ub1804.sh
source /opt/yggdrasil/menus_functions_ub1804.sh
source /opt/yggdrasil/tools_functions_ub1804.sh
else
return 1
fi
#
# check if the script is running in root/sudo