PreTrtFct mechanism added and install fct adapted

This commit is contained in:
shakasan 2018-05-28 14:03:27 +02:00
parent eec24b3fd8
commit 9772f35975
5 changed files with 154 additions and 77 deletions

View file

@ -426,17 +426,26 @@ function addSpecificRepoFct () {
# #
# find and execute Pre/Post install functions for a specific app # find and execute Pre/Post install functions for a specific app
# input : unique ID # input : unique ID, pre/post
# #
function processAppTrtFct () { function processAppTrtFct () {
for i in $AppsTrtFct; do if [ "$2" == "post" ]; then
appTrtFct=(${i//;/ }) for i in $AppsPostTrtFct; do
if [ "${appTrtFct[0]}" == "$1" ]; then appPostTrtFct=(${i//;/ })
printf "[TRT] package -- $1 -- " if [ "${appPostTrtFct[0]}" == "$1" ]; then
printf "post install processed by -- ${appTrtFct[1]}\n" printf "[TRT][POST][$1][${appPostTrtFct[1]}]\n"
eval "${appTrtFct[1]}" eval "${appPostTrtFct[1]}"
fi fi
done 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 for i in $Apps; do
app=(${i//;/ }) app=(${i//;/ })
if [ "${app[2]}" == "$1" ]; then if [ "${app[2]}" == "$1" ]; then
processAppTrtFct ${app[3]} post
installPackage ${app[1]} ${app[0]} installPackage ${app[1]} ${app[0]}
processAppTrtFct ${app[3]} processAppTrtFct ${app[3]} post
fi fi
done done
} }
@ -503,8 +513,9 @@ function installAppsFromListMenu () {
for i in $Apps; do for i in $Apps; do
app=(${i//;/ }) app=(${i//;/ })
if [ "${app[3]}" == "${pkgToInstall//\"}" ]; then if [ "${app[3]}" == "${pkgToInstall//\"}" ]; then
processAppTrtFct ${app[3]} pre
installPackage ${app[1]} ${app[0]} installPackage ${app[1]} ${app[0]}
processAppTrtFct ${app[3]} processAppTrtFct ${app[3]} post
fi fi
done done
done done

View file

@ -70,8 +70,6 @@ function installEbookMenu () {
# install Internet Apps (headless) # install Internet Apps (headless)
# #
function installInternet () { 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 installAppsFromList internet
} }
@ -79,8 +77,6 @@ function installInternet () {
# install Internet Apps (Menu) # install Internet Apps (Menu)
# #
function installInternetMenu () { 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 installAppsFromListMenu internet
} }
@ -166,20 +162,14 @@ function installGamesMenu () {
# Steam (headless) # Steam (headless)
# #
function installSteam () { function installSteam () {
runCmd "echo \"steam steam/purge note\" | sudo debconf-set-selections" \ installAppsFromList steam
"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) # Steam (Menu)
# #
function installSteamMenu () { function installSteamMenu () {
installPackage apt steam installAppsFromListMenu steam
} }
# #
@ -200,8 +190,6 @@ function installBurningToolsMenu () {
# install Network Apps (headless) # install Network Apps (headless)
# #
function installNetTools () { function installNetTools () {
runCmd "echo wireshark-common wireshark-common/install-setuid boolean true | sudo debconf-set-selections" \
"setting Wireshark as root only"
installAppsFromList nettools installAppsFromList nettools
} }
@ -209,8 +197,6 @@ function installNetTools () {
# install Network Apps (Menu) # install Network Apps (Menu)
# #
function installNetToolsMenu () { function installNetToolsMenu () {
runCmd "echo wireshark-common wireshark-common/install-setuid boolean true | sudo debconf-set-selections" \
"setting Wireshark as root only"
installAppsFromListMenu nettools installAppsFromListMenu nettools
} }
@ -616,8 +602,6 @@ function installJavascriptMenu () {
# install JAVA 10 (headless) # install JAVA 10 (headless)
# #
function installJava10 () { 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 installAppsFromList java10
} }
@ -625,8 +609,6 @@ function installJava10 () {
# install JAVA 10 (Menu) # install JAVA 10 (Menu)
# #
function installJava10Menu () { 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 installAppsFromListMenu java10
} }

View file

@ -76,8 +76,6 @@ function installEbookMenu () {
# install Internet Apps (headless) # install Internet Apps (headless)
# #
function installInternet () { 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 installAppsFromList internet
} }
@ -85,8 +83,6 @@ function installInternet () {
# install Internet Apps (Menu) # install Internet Apps (Menu)
# #
function installInternetMenu () { 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 installAppsFromListMenu internet
} }
@ -190,20 +186,14 @@ function installGamesMenu () {
# Steam (headless) # Steam (headless)
# #
function installSteam () { function installSteam () {
runCmd "echo \"steam steam/purge note\" | sudo debconf-set-selections" \ installAppsFromList steam
"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) # Steam (Menu)
# #
function installSteamMenu () { function installSteamMenu () {
installPackage apt steam installAppsFromListMenu steam
} }
# #
@ -224,8 +214,6 @@ function installBurningToolsMenu () {
# install Network Apps (headless) # install Network Apps (headless)
# #
function installNetTools () { function installNetTools () {
runCmd "echo wireshark-common wireshark-common/install-setuid boolean true | sudo debconf-set-selections" \
"setting Wireshark as root only"
installAppsFromList nettools installAppsFromList nettools
} }
@ -233,8 +221,6 @@ function installNetTools () {
# install Network Apps (Menu) # install Network Apps (Menu)
# #
function installNetToolsMenu () { function installNetToolsMenu () {
runCmd "echo wireshark-common wireshark-common/install-setuid boolean true | sudo debconf-set-selections" \
"setting Wireshark as root only"
installAppsFromListMenu nettools installAppsFromListMenu nettools
} }
@ -585,8 +571,6 @@ function installJavascriptMenu () {
# install JAVA 10 (headless) # install JAVA 10 (headless)
# #
function installJava10 () { 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 installAppsFromList java10
} }
@ -594,8 +578,6 @@ function installJava10 () {
# install JAVA 10 (Menu) # install JAVA 10 (Menu)
# #
function installJava10Menu () { 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 installAppsFromListMenu java10
} }

View file

@ -200,6 +200,7 @@ weppy;pip;python;weppy
py-term;pip;python;py-term py-term;pip;python;py-term
jstest-gtk;apt;games;jstest-gtk jstest-gtk;apt;games;jstest-gtk
dosbox;apt;games;dosbox dosbox;apt;games;dosbox
steam;apt;steam;steam
brasero;apt;burningtools;brasero brasero;apt;burningtools;brasero
k3b;apt;burningtools;k3b k3b;apt;burningtools;k3b
k3b-extrathemes;apt;burningtools;k3b-extrathemes k3b-extrathemes;apt;burningtools;k3b-extrathemes
@ -1175,6 +1176,56 @@ function addRepo_AndroidStudio () {
addPPA ppa:maarten-fonville/android-studio 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 # # Package post install functions list #
#-----------------------------------------------------------------------------# #-----------------------------------------------------------------------------#
@ -1183,17 +1234,18 @@ function addRepo_AndroidStudio () {
# list of post install functions # list of post install functions
# fields : unique ID, function to process after install # fields : unique ID, function to process after install
# #
AppsTrtFct="nitrogen;nitrogen_TrtFct AppsPostTrtFct="nitrogen;nitrogen_PostTrtFct
mongodb;mongodb_TrtFct mongodb;mongodb_PostTrtFct
qttools5-dev-tools;qt_TrtFct qttools5-dev-tools;qt_PostTrtFct
plank;plank_TrtFct plank;plank_PostTrtFct
androidstudio;android_TrtFct androidstudio;android_PostTrtFct
nodejs8lts;nodejs8lts_TrtFct" nodejs8lts;nodejs8lts_PostTrtFct
mc;mc_PostTrtFct"
# #
# NodeJS 8 LTS
# #
# function nodejs8lts_PostTrtFct () {
function nodejs8lts_TrtFct () {
msg "Sanitizing NodeJS install" msg "Sanitizing NodeJS install"
if which /usr/local/bin/node >/dev/null; then if which /usr/local/bin/node >/dev/null; then
runCmd "sudo rm /usr/local/bin/node" \ runCmd "sudo rm /usr/local/bin/node" \
@ -1206,7 +1258,7 @@ function nodejs8lts_TrtFct () {
# #
# Android Env for adb, fastboot, .... # Android Env for adb, fastboot, ....
# #
function android_TrtFct () { function android_PostTrtFct () {
msg "Adding Android devices UDEV rules" msg "Adding Android devices UDEV rules"
sudo sh -c "echo 'SUBSYSTEM==\"usb\", ATTR{idVendor}==\"0502\", MODE=\"0666\", OWNER=\""$myHomedir"\" # Acer\n\ 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 # Plank themes
#TODO: test it #TODO: test it
function plank_TrtFct () { function plank_PostTrtFct () {
typeset ret_code typeset ret_code
if ! (( $(ps -ef | grep -v grep | grep plank | wc -l) > 0 )); then if ! (( $(ps -ef | grep -v grep | grep plank | wc -l) > 0 )); then
@ -1283,7 +1335,7 @@ function plank_TrtFct () {
# #
# QT5 Dev Tools # 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" \ 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" "set QT5 as default"
@ -1298,7 +1350,7 @@ function qt_TrtFct () {
# #
# MongoDB 3 CE # MongoDB 3 CE
# #
function mongodb_TrtFct () { function mongodb_PostTrtFct () {
runCmd "sudo systemctl enable mongod.service" \ runCmd "sudo systemctl enable mongod.service" \
"enabling mongod service at boot" "enabling mongod service at boot"
runCmd "sudo systemctl start mongod.service" \ runCmd "sudo systemctl start mongod.service" \
@ -1308,7 +1360,7 @@ function mongodb_TrtFct () {
# #
# nitrogen post install function # nitrogen post install function
# #
function nitrogen_TrtFct () { function nitrogen_PostTrtFct () {
if isMate; then if isMate; then
runCmd "gsettings set org.mate.background draw-background false" \ runCmd "gsettings set org.mate.background draw-background false" \
"disabling Caja background management" "disabling Caja background management"

View file

@ -181,6 +181,7 @@ weppy;pip;python;weppy
py-term;pip;python;py-term py-term;pip;python;py-term
jstest-gtk;apt;games;jstest-gtk jstest-gtk;apt;games;jstest-gtk
dosbox;apt;games;dosbox dosbox;apt;games;dosbox
steam;apt;steam;steam
brasero;apt;burningtools;brasero brasero;apt;burningtools;brasero
k3b;apt;burningtools;k3b k3b;apt;burningtools;k3b
k3b-extrathemes;apt;burningtools;k3b-extrathemes k3b-extrathemes;apt;burningtools;k3b-extrathemes
@ -983,6 +984,55 @@ function addRepo_AndroidStudio () {
addPPA ppa:maarten-fonville/android-studio 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 # # Package post install functions list #
#-----------------------------------------------------------------------------# #-----------------------------------------------------------------------------#
@ -991,17 +1041,17 @@ function addRepo_AndroidStudio () {
# list of post install functions # list of post install functions
# fields : unique ID, function to process after install # fields : unique ID, function to process after install
# #
AppsTrtFct="nitrogen;nitrogen_TrtFct AppsPostTrtFct="nitrogen;nitrogen_PostTrtFct
mongodb;mongodb_TrtFct mongodb;mongodb_PostTrtFct
qttools5-dev-tools;qt_TrtFct qttools5-dev-tools;qt_PostTrtFct
plank;plank_TrtFct plank;plank_PostTrtFct
androidstudio;android_TrtFct androidstudio;android_PostTrtFct
nodejs8lts;nodejs8lts_TrtFct" nodejs8lts;nodejs8lts_PostTrtFct"
# #
# NodeJS 8 LTS
# #
# function nodejs8lts_PostTrtFct () {
function nodejs8lts_TrtFct () {
msg "Sanitizing NodeJS install" msg "Sanitizing NodeJS install"
if which /usr/local/bin/node >/dev/null; then if which /usr/local/bin/node >/dev/null; then
runCmd "sudo rm /usr/local/bin/node" \ runCmd "sudo rm /usr/local/bin/node" \
@ -1014,7 +1064,7 @@ function nodejs8lts_TrtFct () {
# #
# Android Env for adb, fastboot, .... # Android Env for adb, fastboot, ....
# #
function android_TrtFct () { function android_PostTrtFct () {
msg "Adding Android devices UDEV rules" msg "Adding Android devices UDEV rules"
sudo sh -c "echo 'SUBSYSTEM==\"usb\", ATTR{idVendor}==\"0502\", MODE=\"0666\", OWNER=\""$myHomedir"\" # Acer\n\ 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 # Plank themes
#TODO: test it #TODO: test it
function plank_TrtFct () { function plank_PostTrtFct () {
typeset ret_code typeset ret_code
if ! (( $(ps -ef | grep -v grep | grep plank | wc -l) > 0 )); then if ! (( $(ps -ef | grep -v grep | grep plank | wc -l) > 0 )); then
@ -1091,7 +1141,7 @@ function plank_TrtFct () {
# #
# QT5 Dev Tools # 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" \ 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" "set QT5 as default"
@ -1106,7 +1156,7 @@ function qt_TrtFct () {
# #
# MongoDB 3 CE # MongoDB 3 CE
# #
function mongodb_TrtFct () { function mongodb_PostTrtFct () {
runCmd "sudo systemctl enable mongod.service" \ runCmd "sudo systemctl enable mongod.service" \
"enabling mongod service at boot" "enabling mongod service at boot"
runCmd "sudo systemctl start mongod.service" \ runCmd "sudo systemctl start mongod.service" \
@ -1116,7 +1166,7 @@ function mongodb_TrtFct () {
# #
# nitrogen post install function # nitrogen post install function
# #
function nitrogen_TrtFct () { function nitrogen_PostTrtFct () {
if isMate; then if isMate; then
runCmd "gsettings set org.mate.background draw-background false" \ runCmd "gsettings set org.mate.background draw-background false" \
"disabling Caja background management" "disabling Caja background management"