diff --git a/.github/workflows/packaging/deb/control b/.github/workflows/packaging/deb/control index 885a836..5606d29 100644 --- a/.github/workflows/packaging/deb/control +++ b/.github/workflows/packaging/deb/control @@ -3,7 +3,7 @@ Version: __VERSION__ Section: main Priority: optional Architecture: all -Depends: curl, git, apt-transport-https, aptitude, mutt, locales, ngrep, inotify-tools, jq, virt-what, net-tools, locales-all +Depends: curl, git, apt-transport-https, aptitude, mutt, locales, ngrep, inotify-tools, jq, virt-what, net-tools, dnsutils, locales-all Maintainer: Ludovic Description: Linupdate package updater - Repomanager client side agent Homepage: https://github.com/lbr38/linupdate diff --git a/.github/workflows/packaging/rpm/spec b/.github/workflows/packaging/rpm/spec index 98f33a0..ac360fa 100644 --- a/.github/workflows/packaging/rpm/spec +++ b/.github/workflows/packaging/rpm/spec @@ -15,6 +15,7 @@ Requires: inotify-tools Requires: jq Requires: virt-what Requires: net-tools +Requires: bind-utils Requires: yum-utils %description diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e72a306..299045a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -162,7 +162,9 @@ jobs: with: tag_name: ${{ env.VERSION }} release_name: ${{ env.VERSION }} - body: "Fixed services restart after update" + body: | + Added dependencies + Various fixes draft: false prerelease: false diff --git a/functions/04_update b/functions/04_update index d9c3e3d..e7afe6c 100644 --- a/functions/04_update +++ b/functions/04_update @@ -9,68 +9,78 @@ function update fi # Fonction lançant les mises à jour yum - { - echo -e "\nUpdate is running..." + + echo -e "\nUpdate is running..." - echo -ne "Cleaning cache: " - if [ "$OS_FAMILY" == "Redhat" ];then - checkYumLock - yum clean all -q - fi - if [ "$OS_FAMILY" == "Debian" ];then - apt-get clean - fi + echo -ne "Cleaning cache: " + if [ "$OS_FAMILY" == "Redhat" ];then + checkYumLock + yum clean all -q + fi + if [ "$OS_FAMILY" == "Debian" ];then + apt-get clean + fi - echo -e "[$GREEN OK $RESET]" + echo -e "[$GREEN OK $RESET]" - # echo -e "\nInstallation des mises à jour :" + # Si c'est du Debian, on charge la liste des paquets + if [ "$OS_FAMILY" == "Debian" ];then + apt-get -o Acquire::Check-Valid-Until=false -qq --allow-releaseinfo-change update + fi - # Si c'est du Debian, on charge la liste des paquets - if [ "$OS_FAMILY" == "Debian" ];then - apt-get -o Acquire::Check-Valid-Until=false -qq --allow-releaseinfo-change update + # Si $UPDATE_EXCLUDE n'est pas vide, alors on exclu les paquets de la mise à jour + if [ ! -z "$UPDATE_EXCLUDE" ];then + if [ "$OS_FAMILY" == "Redhat" ];then + YUM_OPTIONS+=" --exclude=${UPDATE_EXCLUDE}" + # Trim whitespaces + YUM_OPTIONS="${YUM_OPTIONS#"${YUM_OPTIONS%%[![:space:]]*}"}" + YUM_OPTIONS="${YUM_OPTIONS%"${YUM_OPTIONS##*[![:space:]]}"}" fi - # Si $UPDATE_EXCLUDE n'est pas vide, alors on exclu les paquets de la mise à jour - if [ ! -z "$UPDATE_EXCLUDE" ];then - if [ "$OS_FAMILY" == "Redhat" ];then - YUM_OPTIONS+=" --exclude=${UPDATE_EXCLUDE}" - # Trim whitespaces - YUM_OPTIONS="${YUM_OPTIONS#"${YUM_OPTIONS%%[![:space:]]*}"}" - YUM_OPTIONS="${YUM_OPTIONS%"${YUM_OPTIONS##*[![:space:]]}"}" - fi - if [ "$OS_FAMILY" == "Debian" ];then - echo -e "\nExcluding critical packages: $YELLOW" + if [ "$OS_FAMILY" == "Debian" ];then + echo -e "\nExcluding critical packages: $YELLOW" + IFS=' ' + + for PACKAGE in ${UPDATE_EXCLUDE[@]};do # Attention ne pas placer de double quote sur cette variable + apt-mark hold "$PACKAGE" + if [ "$?" -eq "0" ];then + echo -e "Error while excluding $PACKAGE" + (( UPDATE_ERROR++ )) + return + fi + done - IFS=' ' - for PACKAGE in ${UPDATE_EXCLUDE[@]};do # Attention ne pas placer de double quote sur cette variable - apt-mark hold "$PACKAGE" - done + echo -e "$RESET" + fi + fi - echo -e "$RESET" - fi + # Updating packages + if [ "$OS_FAMILY" == "Redhat" ];then + if [ ! -z "$YUM_OPTIONS" ];then + yum "$YUM_OPTIONS" update -y + else + yum update -y fi + if [ "$?" -ne "0" ];then + (( UPDATE_ERROR++ )) + fi + fi - # Updating packages - if [ "$OS_FAMILY" == "Redhat" ];then - if [ ! -z "$YUM_OPTIONS" ];then - yum "$YUM_OPTIONS" update -y - else - yum update -y - fi + if [ "$OS_FAMILY" == "Debian" ];then + if [ ! -z "$APT_OPTIONS" ];then + apt-get "$APT_UPGRADE" -y "$APT_OPTIONS" + else + apt-get "$APT_UPGRADE" -y fi - if [ "$OS_FAMILY" == "Debian" ];then - if [ ! -z "$APT_OPTIONS" ];then - apt-get "$APT_UPGRADE" -y "$APT_OPTIONS" - else - apt-get "$APT_UPGRADE" -y - fi + if [ "$?" -ne "0" ];then + (( UPDATE_ERROR++ )) fi + fi - echo -e "\n${GREEN}Update completed${RESET}\n" + if [ "$UPDATE_ERROR" -gt "0" ];then + echo -e "\n${RED}Update has failed${RESET}" + return + fi - # If one command fail - } || { - echo -e "\n${YELLOW}Update has failed${RESET}" - (( UPDATE_ERROR++ )) - } + echo -e "\n${GREEN}Update completed${RESET}\n" } \ No newline at end of file diff --git a/functions/99_clean-exit b/functions/99_clean-exit index 481b705..d968fc3 100644 --- a/functions/99_clean-exit +++ b/functions/99_clean-exit @@ -15,5 +15,9 @@ function clean_exit rm "/tmp/linupdate.lock" -f + if [ "$UPDATE_ERROR" -gt "0" ];then + (( ERROR_STATUS++ )) + fi + exit $ERROR_STATUS } \ No newline at end of file diff --git a/linupdate b/linupdate index f03ae6f..9cefd18 100755 --- a/linupdate +++ b/linupdate @@ -380,7 +380,11 @@ execPostModules # Restarting services restartService -echo -e "\nOperation completed\n" +if [ "$UPDATE_ERROR" -gt "0" ];then + echo -e "\nOperation completed with errors\n" +else + echo -e "\nOperation completed\n" +fi # Check if a system reboot is required checkRebootNeeded diff --git a/mods-available/configurations/reposerver.conf b/mods-available/configurations/reposerver.conf index a4bcba6..f67ef76 100644 --- a/mods-available/configurations/reposerver.conf +++ b/mods-available/configurations/reposerver.conf @@ -4,19 +4,14 @@ FAILLEVEL="" [CLIENT] ID="" TOKEN="" -REPOSERVER_ALLOW_CONFUPDATE="" -REPOSERVER_ALLOW_REPOSFILES_UPDATE="" -REPOSERVER_ALLOW_OVERWRITE="" +GET_PROFILE_PKG_CONF_FROM_REPOSERVER="" +GET_PROFILE_REPOS_FROM_REPOSERVER="" +GET_PROFILE_PARAMS_OVERWRITE="" [REPOSERVER] IP="" URL="" -OS_FAMILY="" -OS_NAME="" -OS_VERSION="" -PACKAGES_OS_VERSION="" -MANAGE_CLIENTS_CONF="" -MANAGE_CLIENTS_REPOSCONF="" +PACKAGE_TYPE="" [AGENT] WATCH_FOR_REQUEST="enabled"