diff --git a/.github/workflows/build-deb.yml b/.github/workflows/build-deb.yml index 9e79cc9..5bf6ecf 100644 --- a/.github/workflows/build-deb.yml +++ b/.github/workflows/build-deb.yml @@ -29,7 +29,7 @@ jobs: mkdir -p /tmp/linupdate-build/DEBIAN mkdir -p /tmp/linupdate-build/etc/linupdate/modules mkdir -p /tmp/linupdate-build/opt/linupdate - mkdir -p /tmp/linupdate-build/opt/linupdate/functions/ + mkdir -p /tmp/linupdate-build/opt/linupdate/src/ mkdir -p /tmp/linupdate-build/opt/linupdate/mods-available/ mkdir -p /tmp/linupdate-build/opt/linupdate/mods-enabled/ mkdir -p /tmp/linupdate-build/opt/linupdate/agents-available/ @@ -38,7 +38,7 @@ jobs: - name: Copy files to include in the build run: | - cp -r ${GITHUB_WORKSPACE}/functions/* /tmp/linupdate-build/opt/linupdate/functions/ + cp -r ${GITHUB_WORKSPACE}/src/* /tmp/linupdate-build/opt/linupdate/src/ cp -r ${GITHUB_WORKSPACE}/mods-available/* /tmp/linupdate-build/opt/linupdate/mods-available/ cp -r ${GITHUB_WORKSPACE}/service/* /tmp/linupdate-build/opt/linupdate/service/ cp ${GITHUB_WORKSPACE}/linupdate /tmp/linupdate-build/opt/linupdate/linupdate diff --git a/.github/workflows/build-rpm.yml b/.github/workflows/build-rpm.yml index 371fb27..29dc9b6 100644 --- a/.github/workflows/build-rpm.yml +++ b/.github/workflows/build-rpm.yml @@ -33,7 +33,7 @@ jobs: mkdir -p $HOME/rpmbuild/SPECS mkdir -p /etc/linupdate/modules mkdir -p /opt/linupdate - mkdir -p /opt/linupdate/functions/ + mkdir -p /opt/linupdate/src/ mkdir -p /opt/linupdate/mods-available/ mkdir -p /opt/linupdate/mods-enabled/ mkdir -p /opt/linupdate/agents-available/ @@ -43,7 +43,7 @@ jobs: - name: Copy files to include in the build run: | - cp -r ${GITHUB_WORKSPACE}/functions/* /opt/linupdate/functions/ + cp -r ${GITHUB_WORKSPACE}/src/* /opt/linupdate/src/ cp -r ${GITHUB_WORKSPACE}/mods-available/* /opt/linupdate/mods-available/ cp -r ${GITHUB_WORKSPACE}/service/* /opt/linupdate/service/ cp ${GITHUB_WORKSPACE}/linupdate /opt/linupdate/linupdate diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 03fe672..387f514 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -26,7 +26,7 @@ jobs: mkdir -p /tmp/linupdate-build/DEBIAN mkdir -p /tmp/linupdate-build/etc/linupdate/modules mkdir -p /tmp/linupdate-build/opt/linupdate - mkdir -p /tmp/linupdate-build/opt/linupdate/functions/ + mkdir -p /tmp/linupdate-build/opt/linupdate/src/ mkdir -p /tmp/linupdate-build/opt/linupdate/mods-available/ mkdir -p /tmp/linupdate-build/opt/linupdate/mods-enabled/ mkdir -p /tmp/linupdate-build/opt/linupdate/agents-available/ @@ -35,7 +35,7 @@ jobs: - name: Copy files to include in the build run: | - cp -r ${GITHUB_WORKSPACE}/functions/* /tmp/linupdate-build/opt/linupdate/functions/ + cp -r ${GITHUB_WORKSPACE}/src/* /tmp/linupdate-build/opt/linupdate/src/ cp -r ${GITHUB_WORKSPACE}/mods-available/* /tmp/linupdate-build/opt/linupdate/mods-available/ cp -r ${GITHUB_WORKSPACE}/service/* /tmp/linupdate-build/opt/linupdate/service/ cp ${GITHUB_WORKSPACE}/linupdate /tmp/linupdate-build/opt/linupdate/linupdate @@ -91,7 +91,7 @@ jobs: mkdir -p $HOME/rpmbuild/SPECS mkdir -p /etc/linupdate/modules mkdir -p /opt/linupdate - mkdir -p /opt/linupdate/functions/ + mkdir -p /opt/linupdate/src/ mkdir -p /opt/linupdate/mods-available/ mkdir -p /opt/linupdate/mods-enabled/ mkdir -p /opt/linupdate/agents-available/ @@ -101,7 +101,7 @@ jobs: - name: Copy files to include in the build run: | - cp -r ${GITHUB_WORKSPACE}/functions/* /opt/linupdate/functions/ + cp -r ${GITHUB_WORKSPACE}/src/* /opt/linupdate/src/ cp -r ${GITHUB_WORKSPACE}/mods-available/* /opt/linupdate/mods-available/ cp -r ${GITHUB_WORKSPACE}/service/* /opt/linupdate/service/ cp ${GITHUB_WORKSPACE}/linupdate /opt/linupdate/linupdate diff --git a/linupdate b/linupdate index 8720d36..9434ba1 100755 --- a/linupdate +++ b/linupdate @@ -12,7 +12,7 @@ DATE_FULL=$(date +%d-%m-%Y_%Hh%M) # Today date in 'DD-MM-YYYY_ TIME=$(date +%H:%M) # Time in '00:00' format TIME_FULL=$(date +%Hh%Mm%Ss) # Time in '00h00m00s' format LINUPDATE="${BASE_DIR}/linupdate" # Main program -FUNCTIONS="${BASE_DIR}/functions" # Functions directory +SRC_SIR="${BASE_DIR}/src" # Source code directory LOGS_DIR="/var/log/linupdate" # Logs directory ETC_DIR="/etc/linupdate" # Configuration files directory CONF="${ETC_DIR}/linupdate.conf" # Main configuration file @@ -112,15 +112,15 @@ mkdir -p "$MODULES_ENABLED_DIR" mkdir -p "$AGENTS_ENABLED_DIR" mkdir -p "$SERVICE_DIR" -# If functions dir does not exist then quit -if [ ! -d "$FUNCTIONS" ];then +# If source code dir does not exist then quit +if [ ! -d "$SRC_DIR" ];then echo -e "[$YELLOW ERROR $RESET] Some linupdate core files are missing. You might reinstall linupdate." exit 1 fi -# Sourcing all files inside functions dir -for FUNCTION_FILE in $(ls -A1 "$FUNCTIONS");do - source "$FUNCTIONS/$FUNCTION_FILE" +# Sourcing all files inside src dir +for SRC_FILE in $(ls -A1 "$SRC_DIR");do + source "$SRC_DIR/$SRC_FILE" done # Check that system is valid before continue diff --git a/mods-available/reposerver.mod b/mods-available/reposerver.mod index 2280fdc..43a6872 100644 --- a/mods-available/reposerver.mod +++ b/mods-available/reposerver.mod @@ -554,6 +554,14 @@ function mod_load grep "^URL=" "$MOD_CONF" >> "$TMP_MOD_CONF" fi + if grep -q "^IP=" "$MOD_CONF";then + grep "^IP=" "$MOD_CONF" >> "$TMP_MOD_CONF" + fi + + if grep -q "^PACKAGE_TYPE=" "$MOD_CONF";then + grep "^PACKAGE_TYPE=" "$MOD_CONF" >> "$TMP_MOD_CONF" + fi + # Section [AGENT] echo -e "\n[AGENT]" >> "$TMP_MOD_CONF" if ! grep -q "^WATCH_FOR_REQUEST=" "$MOD_CONF";then @@ -567,9 +575,9 @@ function mod_load grep "^WATCH_INTERFACE=" "$MOD_CONF" >> "$TMP_MOD_CONF" fi - # Remplacement du fichier de conf par le fichier précédemment construit - cat "$TMP_MOD_CONF" > "$MOD_CONF" - rm -f "$TMP_MOD_CONF" + # Remplacement du fichier de conf par le fichier précédemment construit + cat "$TMP_MOD_CONF" > "$MOD_CONF" + rm -f "$TMP_MOD_CONF" # Si l'URL du serveur de repo n'est pas renseignée alors on ne charge pas le module if [ -z $(grep "^URL=" $MOD_CONF | cut -d'=' -f2 | sed 's/"//g') ];then @@ -679,14 +687,14 @@ function getServerConf echo "" >> "$TMP_FILE_CLIENT" # Sauvegarde de la partie [AGENT] si existe - sed -n -e '/\[AGENT\]/,/^$/p' "$MOD_CONF" > "$TMP_FILE_AGENT" + sed -n -e '/\[AGENT\]/,/^$/p' "$MOD_CONF" > "$TMP_FILE_AGENT" # Ajout d'un saut de ligne car chaque section doit être correctement séparée echo "" >> "$TMP_FILE_AGENT" # Nouvelle conf [REPOSERVER] echo "[REPOSERVER]" >> "$TMP_FILE_REPOSERVER" - echo "IP=\"$REPOSERVER_IP\"" >> "$TMP_FILE_REPOSERVER" echo "URL=\"$REPOSERVER_URL\"" >> "$TMP_FILE_REPOSERVER" + echo "IP=\"$REPOSERVER_IP\"" >> "$TMP_FILE_REPOSERVER" echo "PACKAGE_TYPE=\"$REPOSERVER_PACKAGE_TYPE\"" >> "$TMP_FILE_REPOSERVER" echo "" >> "$TMP_FILE_REPOSERVER" @@ -700,7 +708,7 @@ function getServerConf sed -i '/^$/N;/^\n$/D' "$MOD_CONF" # Suppression des fichiers temporaires - rm "$TMP_FILE_MODULE" -f + rm "$TMP_FILE_MODULE" -f rm "$TMP_FILE_CLIENT" -f rm "$TMP_FILE_AGENT" -f rm "$TMP_FILE_REPOSERVER" -f diff --git a/functions/00_check-system b/src/00_check-system similarity index 100% rename from functions/00_check-system rename to src/00_check-system diff --git a/functions/00_exclude b/src/00_exclude similarity index 100% rename from functions/00_exclude rename to src/00_exclude diff --git a/functions/00_generateConf b/src/00_generateConf similarity index 100% rename from functions/00_generateConf rename to src/00_generateConf diff --git a/functions/00_get-conf b/src/00_get-conf similarity index 100% rename from functions/00_get-conf rename to src/00_get-conf diff --git a/functions/00_get-modules b/src/00_get-modules similarity index 100% rename from functions/00_get-modules rename to src/00_get-modules diff --git a/functions/00_help b/src/00_help similarity index 100% rename from functions/00_help rename to src/00_help diff --git a/functions/00_list-modules b/src/00_list-modules similarity index 100% rename from functions/00_list-modules rename to src/00_list-modules diff --git a/functions/00_space-left b/src/00_space-left similarity index 100% rename from functions/00_space-left rename to src/00_space-left diff --git a/functions/01_exec-pre-modules b/src/01_exec-pre-modules similarity index 100% rename from functions/01_exec-pre-modules rename to src/01_exec-pre-modules diff --git a/functions/01_load-modules b/src/01_load-modules similarity index 100% rename from functions/01_load-modules rename to src/01_load-modules diff --git a/functions/02_check-packages-before-update b/src/02_check-packages-before-update similarity index 100% rename from functions/02_check-packages-before-update rename to src/02_check-packages-before-update diff --git a/functions/03_check-yum-lock b/src/03_check-yum-lock similarity index 100% rename from functions/03_check-yum-lock rename to src/03_check-yum-lock diff --git a/functions/04_update b/src/04_update similarity index 100% rename from functions/04_update rename to src/04_update diff --git a/functions/09_exec-post-modules b/src/09_exec-post-modules similarity index 100% rename from functions/09_exec-post-modules rename to src/09_exec-post-modules diff --git a/functions/09_service-restart b/src/09_service-restart similarity index 100% rename from functions/09_service-restart rename to src/09_service-restart diff --git a/functions/10_check-reboot-needed b/src/10_check-reboot-needed similarity index 100% rename from functions/10_check-reboot-needed rename to src/10_check-reboot-needed diff --git a/functions/10_send-mail b/src/10_send-mail similarity index 100% rename from functions/10_send-mail rename to src/10_send-mail diff --git a/functions/200_apt-history-parser b/src/200_apt-history-parser similarity index 100% rename from functions/200_apt-history-parser rename to src/200_apt-history-parser diff --git a/functions/200_yum-history-parser b/src/200_yum-history-parser similarity index 100% rename from functions/200_yum-history-parser rename to src/200_yum-history-parser diff --git a/functions/96_start-agent b/src/96_start-agent similarity index 100% rename from functions/96_start-agent rename to src/96_start-agent diff --git a/functions/97_stop-agent b/src/97_stop-agent similarity index 100% rename from functions/97_stop-agent rename to src/97_stop-agent diff --git a/functions/98_restart-agent b/src/98_restart-agent similarity index 100% rename from functions/98_restart-agent rename to src/98_restart-agent diff --git a/functions/99_clean-exit b/src/99_clean-exit similarity index 100% rename from functions/99_clean-exit rename to src/99_clean-exit diff --git a/functions/99_disable-agent b/src/99_disable-agent similarity index 100% rename from functions/99_disable-agent rename to src/99_disable-agent diff --git a/functions/99_enable-agent b/src/99_enable-agent similarity index 100% rename from functions/99_enable-agent rename to src/99_enable-agent diff --git a/version b/version index c45a01d..3c3ae88 100644 --- a/version +++ b/version @@ -1 +1 @@ -2.2.12 \ No newline at end of file +2.2.13 \ No newline at end of file