tools and menus fct moved to specific file

This commit is contained in:
Francois B 2018-03-21 08:26:38 +01:00
parent 8e154ef51b
commit e4015c6cef
7 changed files with 631 additions and 611 deletions

View file

@ -3,7 +3,7 @@
# compatibility : Mint 18, Ubuntu 16.04, Elementary and other derivatives # # compatibility : Mint 18, Ubuntu 16.04, Elementary and other derivatives #
# author : Francois B. (Makotosan/Shakasan) # # author : Francois B. (Makotosan/Shakasan) #
# licence : GPLv3 # # licence : GPLv3 #
# website : https://makotonoblog.be/ # website : https://makotonoblog.be/ #
#------------------------------------------------------------------------------# #------------------------------------------------------------------------------#
#------------------------------------------------------------------------------# #------------------------------------------------------------------------------#

View file

@ -3,11 +3,11 @@
# compatibility : Mint 18, Ubuntu 16.04, Elementary and other derivatives # # compatibility : Mint 18, Ubuntu 16.04, Elementary and other derivatives #
# author : Francois B. (Makotosan/Shakasan) # # author : Francois B. (Makotosan/Shakasan) #
# licence : GPLv3 # # licence : GPLv3 #
# website : https://makotonoblog.be/ # website : https://makotonoblog.be/ #
#------------------------------------------------------------------------------# #------------------------------------------------------------------------------#
#-----------------------------------------------------------------------------# #-----------------------------------------------------------------------------#
# install, config, ... functions # # install functions #
#-----------------------------------------------------------------------------# #-----------------------------------------------------------------------------#
# #
@ -909,610 +909,4 @@ function installTeamViewer13 () {
function installTeamViewer13Menu () { function installTeamViewer13Menu () {
installPackageDpkg https://download.teamviewer.com/download/linux/teamviewer_amd64.deb \ installPackageDpkg https://download.teamviewer.com/download/linux/teamviewer_amd64.deb \
teamviewer13.deb teamviewer13.deb
}
#
# install/enable Unboud (headless)
#
function enableUnbound () {
msg "Installing Unbound"
installAppsFromList unbound
}
#
# install/enable Unboud (Menu)
#
function enableUnboundMenu () {
installAppsFromListMenu unbound
}
#
# enable ufw at boot time and add rules for installed apps
#
function enableUFW () {
msg "Enabling FireWall (UFW)"
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 () {
msg "Adding NumLockX to MDM/LightDM Default Init"
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 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
#
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 () {
msg "Adding screenfetch to .bashrc"
checkAndInstallDep apt screenfetch screenfetch
runCmd "touch /home/$myHomedir/.bashrc" \
"create .bashrc file if necessary"
runCmd "echo 'screenfetch -t' | tee -a /home/$myHomedir/.bashrc" \
"add 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 () {
msg "Installing unattended-upgrades"
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 () {
msg "Cleaning useless deb package(s)"
runCmd "sudo apt-get -y autoremove" \
"removing not necessary dependencies"
}
#
# remove old versions of installed kernels
#
function toolClearOldKernels () {
msg "Removing old kernels (keeping the 3 last kernels)"
checkAndInstallDep apt byobu purge-old-kernels
runCmd "sudo purge-old-kernels --keep 3" \
"removing old kernels"
}
#
# force soundcards detection
#
function toolSoundCardsDetection () {
runCmd "sudo alsa force-reload" \
"detecting ALSA sound cards"
}
#-----------------------------------------------------------------------------#
# 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" \
"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
;;
"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" \
"java9" "Java 9 dev env" \
"javascript" "JavaScript dev env" \
"nodelts" "NodeJS 8.x LTS" \
"mongodb3ce" "MongoDB 3 CE" \
"php" "PHP dev env" \
"lua" "Lua dev env" \
"ruby" "Ruby dev env" \
"qt" "QT dev env" \
"python" "Python dev env" \
"androidenv" "Set Android env" \
"atom" "Atom" \
"anjuta" "Anjuta" \
"brackets" "Brackets" \
"codeblocks" "CodeBlocks" \
"geany" "Geany" \
"eclipse" "Eclipse" \
"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
;;
"java9")
installJava9
;;
"javascript")
installJavascriptMenu
;;
"mongodb3ce")
installMongo3CEMenu
;;
"php")
installPHPMenu
;;
"lua")
installLUAMenu
;;
"ruby")
installRubyMenu
;;
"qt")
installQTMenu
;;
"python")
installPythonMenu
;;
"androidenv")
#TODO:
;;
"atom")
installAtomMenu
;;
"anjuta")
installAnjutaMenu
;;
"brackets")
installBracketsMenu
;;
"codeblocks")
installCodeBlocksMenu
;;
"geany")
installGeanyMenu
;;
"eclipse")
#TODO:
;;
"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" \
"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
;;
"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" \
"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" \
"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
;;
"nvidia370")
installNvidia370Menu
;;
"nvidia375")
installNvidia375Menu
;;
"nvidia378")
installNvidia378Menu
;;
"nvidia381")
installNvidia381Menu
;;
"nvidia384")
installNvidia384Menu
;;
"tlp")
installTLPMenu
;;
"keyid")
installKeyIDuDev
;;
"WI6320")
fixWirelessIntel6320
;;
"Back")
break
;;
esac
done
} }

458
menus_functions.sh Normal file
View file

@ -0,0 +1,458 @@
#------------------------------------------------------------------------------#
# 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" \
"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
;;
"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" \
"java9" "Java 9 dev env" \
"javascript" "JavaScript dev env" \
"nodelts" "NodeJS 8.x LTS" \
"mongodb3ce" "MongoDB 3 CE" \
"php" "PHP dev env" \
"lua" "Lua dev env" \
"ruby" "Ruby dev env" \
"qt" "QT dev env" \
"python" "Python dev env" \
"androidenv" "Set Android env" \
"atom" "Atom" \
"anjuta" "Anjuta" \
"brackets" "Brackets" \
"codeblocks" "CodeBlocks" \
"geany" "Geany" \
"eclipse" "Eclipse" \
"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
;;
"java9")
installJava9
;;
"javascript")
installJavascriptMenu
;;
"mongodb3ce")
installMongo3CEMenu
;;
"php")
installPHPMenu
;;
"lua")
installLUAMenu
;;
"ruby")
installRubyMenu
;;
"qt")
installQTMenu
;;
"python")
installPythonMenu
;;
"androidenv")
#TODO:
;;
"atom")
installAtomMenu
;;
"anjuta")
installAnjutaMenu
;;
"brackets")
installBracketsMenu
;;
"codeblocks")
installCodeBlocksMenu
;;
"geany")
installGeanyMenu
;;
"eclipse")
#TODO:
;;
"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" \
"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
;;
"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" \
"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" \
"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
;;
"nvidia370")
installNvidia370Menu
;;
"nvidia375")
installNvidia375Menu
;;
"nvidia378")
installNvidia378Menu
;;
"nvidia381")
installNvidia381Menu
;;
"nvidia384")
installNvidia384Menu
;;
"tlp")
installTLPMenu
;;
"keyid")
installKeyIDuDev
;;
"WI6320")
fixWirelessIntel6320
;;
"Back")
break
;;
esac
done
}

View file

@ -3,7 +3,7 @@
# compatibility : Mint 18, Ubuntu 16.04, Elementary and other derivatives # # compatibility : Mint 18, Ubuntu 16.04, Elementary and other derivatives #
# author : Francois B. (Makotosan/Shakasan) # # author : Francois B. (Makotosan/Shakasan) #
# licence : GPLv3 # # licence : GPLv3 #
# website : https://makotonoblog.be/ # website : https://makotonoblog.be/ #
#------------------------------------------------------------------------------# #------------------------------------------------------------------------------#
#-----------------------------------------------------------------------------# #-----------------------------------------------------------------------------#

166
tools_functions.sh Normal file
View file

@ -0,0 +1,166 @@
#------------------------------------------------------------------------------#
# 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 #
#-----------------------------------------------------------------------------#
#
# install/enable Unboud (headless)
#
function enableUnbound () {
msg "Installing Unbound"
installAppsFromList unbound
}
#
# install/enable Unboud (Menu)
#
function enableUnboundMenu () {
installAppsFromListMenu unbound
}
#
# enable ufw at boot time and add rules for installed apps
#
function enableUFW () {
msg "Enabling FireWall (UFW)"
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 () {
msg "Adding NumLockX to MDM/LightDM Default Init"
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 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
#
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 () {
msg "Adding screenfetch to .bashrc"
checkAndInstallDep apt screenfetch screenfetch
runCmd "touch /home/$myHomedir/.bashrc" \
"create .bashrc file if necessary"
runCmd "echo 'screenfetch -t' | tee -a /home/$myHomedir/.bashrc" \
"add 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 () {
msg "Installing unattended-upgrades"
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 () {
msg "Cleaning useless deb package(s)"
runCmd "sudo apt-get -y autoremove" \
"removing not necessary dependencies"
}
#
# remove old versions of installed kernels
#
function toolClearOldKernels () {
msg "Removing old kernels (keeping the 3 last kernels)"
checkAndInstallDep apt byobu purge-old-kernels
runCmd "sudo purge-old-kernels --keep 3" \
"removing old kernels"
}
#
# force soundcards detection
#
function toolSoundCardsDetection () {
runCmd "sudo alsa force-reload" \
"detecting ALSA sound cards"
}

View file

@ -3,7 +3,7 @@
# compatibility : Mint 18, Ubuntu 16.04, Elementary and other derivatives # # compatibility : Mint 18, Ubuntu 16.04, Elementary and other derivatives #
# author : Francois B. (Makotosan/Shakasan) # # author : Francois B. (Makotosan/Shakasan) #
# licence : GPLv3 # # licence : GPLv3 #
# website : https://makotonoblog.be/ # website : https://makotonoblog.be/ #
#------------------------------------------------------------------------------# #------------------------------------------------------------------------------#
#------------------------------------------------------------------------------# #------------------------------------------------------------------------------#

View file

@ -14,6 +14,8 @@ source ./vars.sh
source ./core_functions.sh source ./core_functions.sh
source ./repo_functions.sh source ./repo_functions.sh
source ./install_functions.sh source ./install_functions.sh
source ./menus_functions.sh
source ./tools_functions.sh
# #
# check if the script is running in root/sudo # check if the script is running in root/sudo