diff --git a/core_functions.sh b/core_functions.sh index b366252..82034d0 100644 --- a/core_functions.sh +++ b/core_functions.sh @@ -426,17 +426,26 @@ function addSpecificRepoFct () { # # find and execute Pre/Post install functions for a specific app -# input : unique ID +# input : unique ID, pre/post # 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 + if [ "$2" == "post" ]; then + for i in $AppsPostTrtFct; do + appPostTrtFct=(${i//;/ }) + if [ "${appPostTrtFct[0]}" == "$1" ]; then + printf "[TRT][POST][$1][${appPostTrtFct[1]}]\n" + eval "${appPostTrtFct[1]}" + fi + done + else + for i in $AppsPreTrtFct; do + appPreTrtFct=(${i//;/ }) + if [ "${appPreTrtFct[0]}" == "$1" ]; then + printf "[TRT][PRE][$1][${appPreTrtFct[1]}]\n" + eval "${appPreTrtFct[1]}" + fi + done + fi } # @@ -459,8 +468,9 @@ function installAppsFromList () { for i in $Apps; do app=(${i//;/ }) if [ "${app[2]}" == "$1" ]; then + processAppTrtFct ${app[3]} post installPackage ${app[1]} ${app[0]} - processAppTrtFct ${app[3]} + processAppTrtFct ${app[3]} post fi done } @@ -503,8 +513,9 @@ function installAppsFromListMenu () { for i in $Apps; do app=(${i//;/ }) if [ "${app[3]}" == "${pkgToInstall//\"}" ]; then + processAppTrtFct ${app[3]} pre installPackage ${app[1]} ${app[0]} - processAppTrtFct ${app[3]} + processAppTrtFct ${app[3]} post fi done done diff --git a/install_functions_ub1604.sh b/install_functions_ub1604.sh index 25079ed..e0d0dd1 100644 --- a/install_functions_ub1604.sh +++ b/install_functions_ub1604.sh @@ -70,8 +70,6 @@ function installEbookMenu () { # 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 } @@ -79,8 +77,6 @@ function installInternet () { # 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 } @@ -166,20 +162,14 @@ function installGamesMenu () { # 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 + installAppsFromList steam } # # Steam (Menu) # function installSteamMenu () { - installPackage apt steam + installAppsFromListMenu steam } # @@ -200,8 +190,6 @@ function installBurningToolsMenu () { # 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 } @@ -209,8 +197,6 @@ function installNetTools () { # 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 } @@ -616,8 +602,6 @@ function installJavascriptMenu () { # 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 } @@ -625,8 +609,6 @@ function installJava10 () { # 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 } diff --git a/install_functions_ub1804.sh b/install_functions_ub1804.sh index 04681d6..f6eb00b 100644 --- a/install_functions_ub1804.sh +++ b/install_functions_ub1804.sh @@ -76,8 +76,6 @@ function installEbookMenu () { # 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 } @@ -85,8 +83,6 @@ function installInternet () { # 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 } @@ -190,20 +186,14 @@ function installGamesMenu () { # 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 + installAppsFromList steam } # # Steam (Menu) # function installSteamMenu () { - installPackage apt steam + installAppsFromListMenu steam } # @@ -224,8 +214,6 @@ function installBurningToolsMenu () { # 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 } @@ -233,8 +221,6 @@ function installNetTools () { # 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 } @@ -585,8 +571,6 @@ function installJavascriptMenu () { # 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 } @@ -594,8 +578,6 @@ function installJava10 () { # 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 } diff --git a/repo_functions_ub1604.sh b/repo_functions_ub1604.sh index c244717..48ab919 100644 --- a/repo_functions_ub1604.sh +++ b/repo_functions_ub1604.sh @@ -200,6 +200,7 @@ weppy;pip;python;weppy py-term;pip;python;py-term jstest-gtk;apt;games;jstest-gtk dosbox;apt;games;dosbox +steam;apt;steam;steam brasero;apt;burningtools;brasero k3b;apt;burningtools;k3b k3b-extrathemes;apt;burningtools;k3b-extrathemes @@ -1175,6 +1176,56 @@ function addRepo_AndroidStudio () { addPPA ppa:maarten-fonville/android-studio } +#-----------------------------------------------------------------------------# +# Package pre install functions list # +#-----------------------------------------------------------------------------# + +# +# list of pre install functions +# fields : unique ID, function to process after install +# +AppsPreTrtFct="opera-stable;opera_PreTrtFct +steam;steam_PreTrtFct +wireshark;wireshark_PreTrtFct +oracle-java10-installer;java10_PreTrtFct +oracle-java10-set-default;java10_PreTrtFct" + +# +# JAVA 10 +# +function java10_PreTrtFct () { + runCmd "echo oracle-java10-installer shared/accepted-oracle-license-v1-1 select true | sudo debconf-set-selections" \ + "accepting Oracle Java SE 10 licence agreement" +} + +# +# Opera +# +function opera_PreTrtFct () { + runCmd "echo opera-stable opera-stable/add-deb-source boolean false | sudo debconf-set-selections" \ + "setting as do not add repo" +} + +# +# Steam +# +function steam_PreTrtFct () { + 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" +} + +# +# Wireshark +# +function wireshark_PreTrtFct () { + runCmd "echo wireshark-common wireshark-common/install-setuid boolean true | sudo debconf-set-selections" \ + "setting Wireshark as root only" +} + #-----------------------------------------------------------------------------# # Package post install functions list # #-----------------------------------------------------------------------------# @@ -1183,17 +1234,18 @@ function addRepo_AndroidStudio () { # list of post install functions # fields : unique ID, function to process after install # -AppsTrtFct="nitrogen;nitrogen_TrtFct -mongodb;mongodb_TrtFct -qttools5-dev-tools;qt_TrtFct -plank;plank_TrtFct -androidstudio;android_TrtFct -nodejs8lts;nodejs8lts_TrtFct" +AppsPostTrtFct="nitrogen;nitrogen_PostTrtFct +mongodb;mongodb_PostTrtFct +qttools5-dev-tools;qt_PostTrtFct +plank;plank_PostTrtFct +androidstudio;android_PostTrtFct +nodejs8lts;nodejs8lts_PostTrtFct +mc;mc_PostTrtFct" # +# NodeJS 8 LTS # -# -function nodejs8lts_TrtFct () { +function nodejs8lts_PostTrtFct () { msg "Sanitizing NodeJS install" if which /usr/local/bin/node >/dev/null; then runCmd "sudo rm /usr/local/bin/node" \ @@ -1206,7 +1258,7 @@ function nodejs8lts_TrtFct () { # # Android Env for adb, fastboot, .... # -function android_TrtFct () { +function android_PostTrtFct () { msg "Adding Android devices UDEV rules" sudo sh -c "echo 'SUBSYSTEM==\"usb\", ATTR{idVendor}==\"0502\", MODE=\"0666\", OWNER=\""$myHomedir"\" # Acer\n\ @@ -1255,7 +1307,7 @@ SUBSYSTEM==\"usb\", ATTR{idVendor}==\"19d2\", MODE=\"0666\", OWNER=\""$myHomedir # # Plank themes #TODO: test it -function plank_TrtFct () { +function plank_PostTrtFct () { typeset ret_code if ! (( $(ps -ef | grep -v grep | grep plank | wc -l) > 0 )); then @@ -1283,7 +1335,7 @@ function plank_TrtFct () { # # QT5 Dev Tools # -function qt_TrtFct () { +function qt_PostTrtFct () { runCmd "sudo ln -s /usr/share/qtchooser/qt5-x86_64-linux-gnu.conf /usr/lib/x86_64-linux-gnu/qtchooser/default.conf" \ "set QT5 as default" @@ -1298,7 +1350,7 @@ function qt_TrtFct () { # # MongoDB 3 CE # -function mongodb_TrtFct () { +function mongodb_PostTrtFct () { runCmd "sudo systemctl enable mongod.service" \ "enabling mongod service at boot" runCmd "sudo systemctl start mongod.service" \ @@ -1308,7 +1360,7 @@ function mongodb_TrtFct () { # # nitrogen post install function # -function nitrogen_TrtFct () { +function nitrogen_PostTrtFct () { if isMate; then runCmd "gsettings set org.mate.background draw-background false" \ "disabling Caja background management" diff --git a/repo_functions_ub1804.sh b/repo_functions_ub1804.sh index 6011578..d74c1f8 100644 --- a/repo_functions_ub1804.sh +++ b/repo_functions_ub1804.sh @@ -181,6 +181,7 @@ weppy;pip;python;weppy py-term;pip;python;py-term jstest-gtk;apt;games;jstest-gtk dosbox;apt;games;dosbox +steam;apt;steam;steam brasero;apt;burningtools;brasero k3b;apt;burningtools;k3b k3b-extrathemes;apt;burningtools;k3b-extrathemes @@ -983,6 +984,55 @@ function addRepo_AndroidStudio () { addPPA ppa:maarten-fonville/android-studio } +#-----------------------------------------------------------------------------# +# Package pre install functions list # +#-----------------------------------------------------------------------------# + +# +# list of pre install functions +# fields : unique ID, function to process after install +# +AppsPreTrtFct="opera-stable;opera_PreTrtFct +steam;steam_PreTrtFct +wireshark;wireshark_PreTrtFct +oracle-java10-installer;java10_PreTrtFct +oracle-java10-set-default;java10_PreTrtFct" + +# +# JAVA 10 +# +function java10_PreTrtFct () { + runCmd "echo oracle-java10-installer shared/accepted-oracle-license-v1-1 select true | sudo debconf-set-selections" \ + "accepting Oracle Java SE 10 licence agreement" +} +# +# Opera +# +function opera_PreTrtFct () { + runCmd "echo opera-stable opera-stable/add-deb-source boolean false | sudo debconf-set-selections" \ + "setting as do not add repo" +} + +# +# Steam +# +function steam_PreTrtFct () { + 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" +} + +# +# Wireshark +# +function wireshark_PreTrtFct () { + runCmd "echo wireshark-common wireshark-common/install-setuid boolean true | sudo debconf-set-selections" \ + "setting Wireshark as root only" +} + #-----------------------------------------------------------------------------# # Package post install functions list # #-----------------------------------------------------------------------------# @@ -991,17 +1041,17 @@ function addRepo_AndroidStudio () { # list of post install functions # fields : unique ID, function to process after install # -AppsTrtFct="nitrogen;nitrogen_TrtFct -mongodb;mongodb_TrtFct -qttools5-dev-tools;qt_TrtFct -plank;plank_TrtFct -androidstudio;android_TrtFct -nodejs8lts;nodejs8lts_TrtFct" +AppsPostTrtFct="nitrogen;nitrogen_PostTrtFct +mongodb;mongodb_PostTrtFct +qttools5-dev-tools;qt_PostTrtFct +plank;plank_PostTrtFct +androidstudio;android_PostTrtFct +nodejs8lts;nodejs8lts_PostTrtFct" # +# NodeJS 8 LTS # -# -function nodejs8lts_TrtFct () { +function nodejs8lts_PostTrtFct () { msg "Sanitizing NodeJS install" if which /usr/local/bin/node >/dev/null; then runCmd "sudo rm /usr/local/bin/node" \ @@ -1014,7 +1064,7 @@ function nodejs8lts_TrtFct () { # # Android Env for adb, fastboot, .... # -function android_TrtFct () { +function android_PostTrtFct () { msg "Adding Android devices UDEV rules" sudo sh -c "echo 'SUBSYSTEM==\"usb\", ATTR{idVendor}==\"0502\", MODE=\"0666\", OWNER=\""$myHomedir"\" # Acer\n\ @@ -1063,7 +1113,7 @@ SUBSYSTEM==\"usb\", ATTR{idVendor}==\"19d2\", MODE=\"0666\", OWNER=\""$myHomedir # # Plank themes #TODO: test it -function plank_TrtFct () { +function plank_PostTrtFct () { typeset ret_code if ! (( $(ps -ef | grep -v grep | grep plank | wc -l) > 0 )); then @@ -1091,7 +1141,7 @@ function plank_TrtFct () { # # QT5 Dev Tools # -function qt_TrtFct () { +function qt_PostTrtFct () { runCmd "sudo ln -s /usr/share/qtchooser/qt5-x86_64-linux-gnu.conf /usr/lib/x86_64-linux-gnu/qtchooser/default.conf" \ "set QT5 as default" @@ -1106,7 +1156,7 @@ function qt_TrtFct () { # # MongoDB 3 CE # -function mongodb_TrtFct () { +function mongodb_PostTrtFct () { runCmd "sudo systemctl enable mongod.service" \ "enabling mongod service at boot" runCmd "sudo systemctl start mongod.service" \ @@ -1116,7 +1166,7 @@ function mongodb_TrtFct () { # # nitrogen post install function # -function nitrogen_TrtFct () { +function nitrogen_PostTrtFct () { if isMate; then runCmd "gsettings set org.mate.background draw-background false" \ "disabling Caja background management"