fixed the way to obtain package lists, mutualised debian familly conf, added separator
This commit is contained in:
@@ -15,11 +15,6 @@ export COM_UPGRADE="full-upgrade -y"
|
||||
export COM_REMOVE="remove --purge -y"
|
||||
export COM_AUTOREM="autoremove --purge -y"
|
||||
|
||||
export GET_INSTALLLIST="apt-get -s install @pkg@ -V | grep 'Inst' | awk '{print$2}'"
|
||||
export GET_UPGRADELIST="apt-get -s full-upgrade -V | grep 'Inst' | awk '{print$2}'"
|
||||
export GET_REMOVELIST="apt-get -s remove @pkg@ -V | grep 'Remv' | awk '{print$2}'"
|
||||
export GET_AUTOREMLIST="apt-get -s autoremove -V | grep 'Remv' | awk '{print$2}'"
|
||||
|
||||
# Special variable for apt like tools to disable any interactive behaviour
|
||||
# This is not used by init.sh
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
@@ -34,3 +29,26 @@ export RC_SCRIPTS_PATH="/etc/init.d"
|
||||
#export INIT_COM="systemctl %comm% %srv%"
|
||||
# Init Upstart (plus ou moins universel)
|
||||
export INIT_COM="service %srv% %com%"
|
||||
|
||||
get_install_list()
|
||||
{
|
||||
apt-get -s install $@ -V | grep "Inst" | awk '{print $2}'
|
||||
}
|
||||
|
||||
|
||||
get_upgrade_list()
|
||||
{
|
||||
apt-get -s full-upgrade -V | grep 'Inst' | awk '{print $2}'
|
||||
}
|
||||
|
||||
|
||||
get_remove_list()
|
||||
{
|
||||
apt-get -s remove $@ -V | grep 'Remv' | awk '{print $2}'
|
||||
}
|
||||
|
||||
|
||||
get_autorem_list()
|
||||
{
|
||||
apt-get -s autoremove -V | grep 'Remv' | awk '{print $2}'
|
||||
}
|
||||
|
||||
@@ -7,27 +7,10 @@
|
||||
# https://opensource.org/licenses/BSD-3-Clause
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# Conf gestionnaire de paquet
|
||||
export PKG_MAN="apt-get"
|
||||
export COM_INSTALL="install -y"
|
||||
export COM_UPDATE="update"
|
||||
export COM_UPGRADE="full-upgrade -y"
|
||||
export COM_REMOVE="remove --purge -y"
|
||||
export COM_AUTOREM="autoremove --purge -y"
|
||||
# Everything declared for Debian works on Devuan...
|
||||
. $MYPATH/conf/auto/debian.conf.sh
|
||||
|
||||
export GET_INSTALLLIST="apt-get -s install @pkg@ -V | grep 'Inst' | awk '{print$2}'"
|
||||
export GET_UPGRADELIST="apt-get -s full-upgrade -V | grep 'Inst' | awk '{print$2}'"
|
||||
export GET_REMOVELIST="apt-get -s remove @pkg@ -V | grep 'Remv' | awk '{print$2}'"
|
||||
export GET_AUTOREMLIST="apt-get -s autoremove -V | grep 'Remv' | awk '{print$2}'"
|
||||
|
||||
# Special variable for apt tools to disable any interactive behaviour
|
||||
# This is not used by init.sh
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
# Conf chemin
|
||||
export RC_SCRIPTS_PATH="/etc/init.d"
|
||||
|
||||
# Conf init
|
||||
# Except init system :
|
||||
# Init SystemV ou OpenRC:
|
||||
export INIT_COM="$RC_SCRIPTS_PATH/%srv% %com%"
|
||||
# Init Systemd:
|
||||
|
||||
11
conf/auto/linuxmint.conf.sh
Normal file
11
conf/auto/linuxmint.conf.sh
Normal file
@@ -0,0 +1,11 @@
|
||||
# ------------------------------------------------------------------------------
|
||||
# Declaration specific to Linux Mint
|
||||
# Copyright (c) 2019-2021 Geoffray Levasseur <fatalerrors@geoffray-levasseur.org>
|
||||
# ------------------------------------------------------------------------------
|
||||
# This file is distributed under 3-clause BSD license.
|
||||
# The complete license agreement can be obtained at:
|
||||
# https://opensource.org/licenses/BSD-3-Clause
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# Everything declared for Debian works on Linux Mint
|
||||
. $MYPATH/conf/auto/debian.conf.sh
|
||||
@@ -7,30 +7,5 @@
|
||||
# https://opensource.org/licenses/BSD-3-Clause
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# Conf gestionnaire de paquet
|
||||
export PKG_MAN="apt-get"
|
||||
export COM_INSTALL="install -y"
|
||||
export COM_UPDATE="update"
|
||||
export COM_UPGRADE="full-upgrade -y"
|
||||
export COM_REMOVE="remove --purge -y"
|
||||
export COM_AUTOREM="autoremove --purge -y"
|
||||
|
||||
export GET_INSTALLLIST="apt-get -s install @pkg@ -V | grep 'Inst' | awk '{print$2}'"
|
||||
export GET_UPGRADELIST="apt-get -s full-upgrade -V | grep 'Inst' | awk '{print$2}'"
|
||||
export GET_REMOVELIST="apt-get -s remove @pkg@ -V | grep 'Remv' | awk '{print$2}'"
|
||||
export GET_AUTOREMLIST="apt-get -s autoremove -V | grep 'Remv' | awk '{print$2}'"
|
||||
|
||||
# Special variable for apt tools to disable any interactive behaviour
|
||||
# This is not used by init.sh
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
# Conf chemin
|
||||
export RC_SCRIPTS_PATH="/etc/init.d"
|
||||
|
||||
# Conf init
|
||||
# Init SystemV ou OpenRC:
|
||||
#export INIT_COM="$RC_SCRIPTS_PATH/%srv% %comm%"
|
||||
# Init Systemd:
|
||||
#export INIT_COM="systemctl %comm% %srv%"
|
||||
# Init Upstart (plus ou moins universel)
|
||||
export INIT_COM="service %srv% %com%"
|
||||
# Everything declared for Debian works on Ubuntu
|
||||
. $MYPATH/conf/auto/debian.conf.sh
|
||||
|
||||
12
init.sh
12
init.sh
@@ -110,6 +110,8 @@ fi
|
||||
# -- Cannot be a function ends here
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
separator
|
||||
|
||||
if [[ -n $CHROOT_PATH && -z $CHROOT_DONE ]]; then
|
||||
chroot_bootstrap $@
|
||||
prnt I "Normal end of chrooted execution!"
|
||||
@@ -141,6 +143,8 @@ for mod in $MODULE_LIST; do
|
||||
done
|
||||
unset mod
|
||||
|
||||
separator
|
||||
|
||||
if [[ $RUN_SHELL == true ]]; then
|
||||
prnt I "Launching an interactive shell..."
|
||||
bash --rcfile $MYPATH/bash.rc -i
|
||||
@@ -216,7 +220,7 @@ if [[ $JUMP == true ]]; then
|
||||
else
|
||||
prnt I "All checks have been run successfully."
|
||||
fi
|
||||
echo
|
||||
echo && separator && echo
|
||||
|
||||
if [[ $KEEPGOING == true ]]; then
|
||||
echo -e "${BRed}ATTENTION : You asked to continue the script even if error occurs.${DEFAULTCOL}"
|
||||
@@ -228,8 +232,9 @@ echo -e "${BYellow}If you continue after that step system will have changes!${DE
|
||||
echo
|
||||
|
||||
dump_key_buffer
|
||||
read -n 1 -rsp $"Press <C> pour key to continue or an other one to stop now..." key
|
||||
echo
|
||||
read -n 1 -rsp $"Press <C> pour key to continue or an other one to stop now..." key && echo
|
||||
|
||||
echo && separator && echo
|
||||
|
||||
if [[ $key == "C" || $key == 'c' ]]; then
|
||||
# We launch modules one after one
|
||||
@@ -242,6 +247,7 @@ if [[ $key == "C" || $key == 'c' ]]; then
|
||||
prnt I "Applying changes for $mod version ${!version}..."
|
||||
$mod
|
||||
echo $mod >> $STAGE_FILE # Mark as done for resuming function
|
||||
separator
|
||||
done
|
||||
unset mod
|
||||
echo
|
||||
|
||||
@@ -124,6 +124,20 @@ prnt()
|
||||
export -f prnt
|
||||
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Draw a separator line
|
||||
separator()
|
||||
{
|
||||
echo -ne "$BYellow"
|
||||
local i=0
|
||||
for i in {1..79}; do
|
||||
echo -n "-"
|
||||
done
|
||||
echo -e "$DEFAULTCOL"
|
||||
}
|
||||
export -f separator
|
||||
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Sleep and display a counter (or "the second parameter" every second)
|
||||
dsleep()
|
||||
@@ -141,6 +155,8 @@ dsleep()
|
||||
done
|
||||
echo
|
||||
}
|
||||
export -f dsleep
|
||||
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Dump the keyboard's buffer
|
||||
|
||||
@@ -99,9 +99,7 @@ export -f pkgautorm
|
||||
# Execute preinstallation code
|
||||
exec_preinst()
|
||||
{
|
||||
local cmd=$(echo $GET_INSTALLLIST | sed "s/@pkg@/$@/")
|
||||
local pkglist=$($cmd)
|
||||
unset $cmd
|
||||
local pkglist=$(get_install_list $@)
|
||||
for pkg in $pkglist; do
|
||||
if [[ $(function_exists preinst_$pkg) ]]; then
|
||||
prnt I "Running $pkg preinstallation script..."
|
||||
@@ -136,8 +134,7 @@ export -f exec_postinst
|
||||
# Execute preremove code
|
||||
exec_prerm()
|
||||
{
|
||||
local cmd=$(echo $GET_REMOVELIST | sed "s/@pkg@/$@/")
|
||||
local pkglist=$($cmd)
|
||||
local pkglist=$(get_remove_list $@)
|
||||
unset $cmd
|
||||
for pkg in $pkglist; do
|
||||
if [[ $(function_exists prerm_$pkg) ]]; then
|
||||
@@ -173,7 +170,7 @@ export -f exec_postrm
|
||||
# Execute preupgrade code
|
||||
exec_preupgd()
|
||||
{
|
||||
local pkglist=$($GET_UPGRADELIST)
|
||||
local pkglist=$(get_upgrade_list)
|
||||
for pkg in $pkglist; do
|
||||
if [[ $(function_exists preupgd_$pkg) ]]; then
|
||||
prnt I "Running $pkg preupgrade script..."
|
||||
@@ -208,7 +205,7 @@ export -f exec_postupgd
|
||||
# Execute prerm code in autoremove context
|
||||
exec_preautorm()
|
||||
{
|
||||
local pkglist=$($GET_AUTOREMLIST)
|
||||
local pkglist=$(get_autorem_list)
|
||||
for pkg in $pkglist; do
|
||||
if [[ $(function_exists prerm_$pkg) ]]; then
|
||||
prnt I "Running $pkg preremove script..."
|
||||
|
||||
Reference in New Issue
Block a user