Skip to content

Commit

Permalink
Merge pull request #46 from lbr38/devel
Browse files Browse the repository at this point in the history
2.2.9
  • Loading branch information
lbr38 authored Aug 24, 2023
2 parents 7860560 + 88a2cfc commit fc5f3b6
Show file tree
Hide file tree
Showing 7 changed files with 78 additions and 62 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/packaging/deb/control
Original file line number Diff line number Diff line change
Expand Up @@ -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 <[email protected]>
Description: Linupdate package updater - Repomanager client side agent
Homepage: https://github.com/lbr38/linupdate
1 change: 1 addition & 0 deletions .github/workflows/packaging/rpm/spec
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Requires: inotify-tools
Requires: jq
Requires: virt-what
Requires: net-tools
Requires: bind-utils
Requires: yum-utils

%description
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
110 changes: 60 additions & 50 deletions functions/04_update
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
4 changes: 4 additions & 0 deletions functions/99_clean-exit
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,9 @@ function clean_exit

rm "/tmp/linupdate.lock" -f

if [ "$UPDATE_ERROR" -gt "0" ];then
(( ERROR_STATUS++ ))
fi

exit $ERROR_STATUS
}
6 changes: 5 additions & 1 deletion linupdate
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 4 additions & 9 deletions mods-available/configurations/reposerver.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit fc5f3b6

Please sign in to comment.