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_REMOVE="remove --purge -y"
|
||||||
export COM_AUTOREM="autoremove --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
|
# Special variable for apt like tools to disable any interactive behaviour
|
||||||
# This is not used by init.sh
|
# This is not used by init.sh
|
||||||
export DEBIAN_FRONTEND=noninteractive
|
export DEBIAN_FRONTEND=noninteractive
|
||||||
@@ -34,3 +29,26 @@ export RC_SCRIPTS_PATH="/etc/init.d"
|
|||||||
#export INIT_COM="systemctl %comm% %srv%"
|
#export INIT_COM="systemctl %comm% %srv%"
|
||||||
# Init Upstart (plus ou moins universel)
|
# Init Upstart (plus ou moins universel)
|
||||||
export INIT_COM="service %srv% %com%"
|
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
|
# https://opensource.org/licenses/BSD-3-Clause
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
# Conf gestionnaire de paquet
|
# Everything declared for Debian works on Devuan...
|
||||||
export PKG_MAN="apt-get"
|
. $MYPATH/conf/auto/debian.conf.sh
|
||||||
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}'"
|
# Except init system :
|
||||||
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:
|
# Init SystemV ou OpenRC:
|
||||||
export INIT_COM="$RC_SCRIPTS_PATH/%srv% %com%"
|
export INIT_COM="$RC_SCRIPTS_PATH/%srv% %com%"
|
||||||
# Init Systemd:
|
# 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
|
# https://opensource.org/licenses/BSD-3-Clause
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
# Conf gestionnaire de paquet
|
# Everything declared for Debian works on Ubuntu
|
||||||
export PKG_MAN="apt-get"
|
. $MYPATH/conf/auto/debian.conf.sh
|
||||||
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%"
|
|
||||||
|
|||||||
12
init.sh
12
init.sh
@@ -110,6 +110,8 @@ fi
|
|||||||
# -- Cannot be a function ends here
|
# -- Cannot be a function ends here
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
separator
|
||||||
|
|
||||||
if [[ -n $CHROOT_PATH && -z $CHROOT_DONE ]]; then
|
if [[ -n $CHROOT_PATH && -z $CHROOT_DONE ]]; then
|
||||||
chroot_bootstrap $@
|
chroot_bootstrap $@
|
||||||
prnt I "Normal end of chrooted execution!"
|
prnt I "Normal end of chrooted execution!"
|
||||||
@@ -141,6 +143,8 @@ for mod in $MODULE_LIST; do
|
|||||||
done
|
done
|
||||||
unset mod
|
unset mod
|
||||||
|
|
||||||
|
separator
|
||||||
|
|
||||||
if [[ $RUN_SHELL == true ]]; then
|
if [[ $RUN_SHELL == true ]]; then
|
||||||
prnt I "Launching an interactive shell..."
|
prnt I "Launching an interactive shell..."
|
||||||
bash --rcfile $MYPATH/bash.rc -i
|
bash --rcfile $MYPATH/bash.rc -i
|
||||||
@@ -216,7 +220,7 @@ if [[ $JUMP == true ]]; then
|
|||||||
else
|
else
|
||||||
prnt I "All checks have been run successfully."
|
prnt I "All checks have been run successfully."
|
||||||
fi
|
fi
|
||||||
echo
|
echo && separator && echo
|
||||||
|
|
||||||
if [[ $KEEPGOING == true ]]; then
|
if [[ $KEEPGOING == true ]]; then
|
||||||
echo -e "${BRed}ATTENTION : You asked to continue the script even if error occurs.${DEFAULTCOL}"
|
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
|
echo
|
||||||
|
|
||||||
dump_key_buffer
|
dump_key_buffer
|
||||||
read -n 1 -rsp $"Press <C> pour key to continue or an other one to stop now..." key
|
read -n 1 -rsp $"Press <C> pour key to continue or an other one to stop now..." key && echo
|
||||||
echo
|
|
||||||
|
echo && separator && echo
|
||||||
|
|
||||||
if [[ $key == "C" || $key == 'c' ]]; then
|
if [[ $key == "C" || $key == 'c' ]]; then
|
||||||
# We launch modules one after one
|
# We launch modules one after one
|
||||||
@@ -242,6 +247,7 @@ if [[ $key == "C" || $key == 'c' ]]; then
|
|||||||
prnt I "Applying changes for $mod version ${!version}..."
|
prnt I "Applying changes for $mod version ${!version}..."
|
||||||
$mod
|
$mod
|
||||||
echo $mod >> $STAGE_FILE # Mark as done for resuming function
|
echo $mod >> $STAGE_FILE # Mark as done for resuming function
|
||||||
|
separator
|
||||||
done
|
done
|
||||||
unset mod
|
unset mod
|
||||||
echo
|
echo
|
||||||
|
|||||||
@@ -124,6 +124,20 @@ prnt()
|
|||||||
export -f 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)
|
# Sleep and display a counter (or "the second parameter" every second)
|
||||||
dsleep()
|
dsleep()
|
||||||
@@ -141,6 +155,8 @@ dsleep()
|
|||||||
done
|
done
|
||||||
echo
|
echo
|
||||||
}
|
}
|
||||||
|
export -f dsleep
|
||||||
|
|
||||||
|
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
# Dump the keyboard's buffer
|
# Dump the keyboard's buffer
|
||||||
|
|||||||
@@ -99,9 +99,7 @@ export -f pkgautorm
|
|||||||
# Execute preinstallation code
|
# Execute preinstallation code
|
||||||
exec_preinst()
|
exec_preinst()
|
||||||
{
|
{
|
||||||
local cmd=$(echo $GET_INSTALLLIST | sed "s/@pkg@/$@/")
|
local pkglist=$(get_install_list $@)
|
||||||
local pkglist=$($cmd)
|
|
||||||
unset $cmd
|
|
||||||
for pkg in $pkglist; do
|
for pkg in $pkglist; do
|
||||||
if [[ $(function_exists preinst_$pkg) ]]; then
|
if [[ $(function_exists preinst_$pkg) ]]; then
|
||||||
prnt I "Running $pkg preinstallation script..."
|
prnt I "Running $pkg preinstallation script..."
|
||||||
@@ -136,8 +134,7 @@ export -f exec_postinst
|
|||||||
# Execute preremove code
|
# Execute preremove code
|
||||||
exec_prerm()
|
exec_prerm()
|
||||||
{
|
{
|
||||||
local cmd=$(echo $GET_REMOVELIST | sed "s/@pkg@/$@/")
|
local pkglist=$(get_remove_list $@)
|
||||||
local pkglist=$($cmd)
|
|
||||||
unset $cmd
|
unset $cmd
|
||||||
for pkg in $pkglist; do
|
for pkg in $pkglist; do
|
||||||
if [[ $(function_exists prerm_$pkg) ]]; then
|
if [[ $(function_exists prerm_$pkg) ]]; then
|
||||||
@@ -173,7 +170,7 @@ export -f exec_postrm
|
|||||||
# Execute preupgrade code
|
# Execute preupgrade code
|
||||||
exec_preupgd()
|
exec_preupgd()
|
||||||
{
|
{
|
||||||
local pkglist=$($GET_UPGRADELIST)
|
local pkglist=$(get_upgrade_list)
|
||||||
for pkg in $pkglist; do
|
for pkg in $pkglist; do
|
||||||
if [[ $(function_exists preupgd_$pkg) ]]; then
|
if [[ $(function_exists preupgd_$pkg) ]]; then
|
||||||
prnt I "Running $pkg preupgrade script..."
|
prnt I "Running $pkg preupgrade script..."
|
||||||
@@ -208,7 +205,7 @@ export -f exec_postupgd
|
|||||||
# Execute prerm code in autoremove context
|
# Execute prerm code in autoremove context
|
||||||
exec_preautorm()
|
exec_preautorm()
|
||||||
{
|
{
|
||||||
local pkglist=$($GET_AUTOREMLIST)
|
local pkglist=$(get_autorem_list)
|
||||||
for pkg in $pkglist; do
|
for pkg in $pkglist; do
|
||||||
if [[ $(function_exists prerm_$pkg) ]]; then
|
if [[ $(function_exists prerm_$pkg) ]]; then
|
||||||
prnt I "Running $pkg preremove script..."
|
prnt I "Running $pkg preremove script..."
|
||||||
|
|||||||
Reference in New Issue
Block a user