diff --git a/.github/workflows/build-deb.yml b/.github/workflows/build-deb.yml index 4e03e33..61fc643 100644 --- a/.github/workflows/build-deb.yml +++ b/.github/workflows/build-deb.yml @@ -96,6 +96,19 @@ jobs: apt-get update -y apt-get install -y ./linupdate-test-build_${{ env.VERSION }}_all.deb + - name: Test some params + run: | + /opt/linupdate/linupdate --help + /opt/linupdate/linupdate --version + /opt/linupdate/linupdate --check-updates + /opt/linupdate/linupdate --profile container + /opt/linupdate/linupdate --env test + /opt/linupdate/linupdate --mod-enable reposerver + /opt/linupdate/linupdate --mod-configure reposerver --url https://packages.bespin.ovh --fail-level 3 + /opt/linupdate/linupdate --mod-configure reposerver --api-key ${{ secrets.REPOSITORY_TOKEN }} --register + /opt/linupdate/linupdate --mod-configure reposerver --send-full-status + /opt/linupdate/linupdate --mod-configure reposerver --unregister + # Try to install package on Debian 11 install-debian-11: name: Install on Debian 11 @@ -123,6 +136,59 @@ jobs: apt-get update -y apt-get install -y ./linupdate-test-build_${{ env.VERSION }}_all.deb + - name: Test some params + run: | + /opt/linupdate/linupdate --help + /opt/linupdate/linupdate --version + /opt/linupdate/linupdate --check-updates + /opt/linupdate/linupdate --profile container + /opt/linupdate/linupdate --env test + /opt/linupdate/linupdate --mod-enable reposerver + /opt/linupdate/linupdate --mod-configure reposerver --url https://packages.bespin.ovh --fail-level 3 + /opt/linupdate/linupdate --mod-configure reposerver --api-key ${{ secrets.REPOSITORY_TOKEN }} --register + /opt/linupdate/linupdate --mod-configure reposerver --send-full-status + /opt/linupdate/linupdate --mod-configure reposerver --unregister + + # Try to install package on Debian 12 + install-debian-12: + name: Install on Debian 12 + needs: + build-deb + runs-on: ubuntu-latest + container: + image: debian:12 + options: --user root + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Get linupdate version + run: echo "VERSION=$(cat ${GITHUB_WORKSPACE}/version)" >> $GITHUB_ENV + + # Download builded deb package artifact + - name: Download artifact + uses: actions/download-artifact@v3 + with: + name: linupdate-test-build_${{ env.VERSION }}_all.deb + + - name: Install package + run: | + apt-get update -y + apt-get install -y ./linupdate-test-build_${{ env.VERSION }}_all.deb + + - name: Test some params + run: | + /opt/linupdate/linupdate --help + /opt/linupdate/linupdate --version + /opt/linupdate/linupdate --check-updates + /opt/linupdate/linupdate --profile container + /opt/linupdate/linupdate --env test + /opt/linupdate/linupdate --mod-enable reposerver + /opt/linupdate/linupdate --mod-configure reposerver --url https://packages.bespin.ovh --fail-level 3 + /opt/linupdate/linupdate --mod-configure reposerver --api-key ${{ secrets.REPOSITORY_TOKEN }} --register + /opt/linupdate/linupdate --mod-configure reposerver --send-full-status + /opt/linupdate/linupdate --mod-configure reposerver --unregister + # Try to install package on Ubuntu (latest) install-ubuntu: name: Install on Ubuntu (latest) @@ -145,4 +211,17 @@ jobs: - name: Install package run: | sudo apt-get update -y - sudo apt-get install -y ./linupdate-test-build_${{ env.VERSION }}_all.deb \ No newline at end of file + sudo apt-get install -y ./linupdate-test-build_${{ env.VERSION }}_all.deb + + - name: Test some params + run: | + sudo /opt/linupdate/linupdate --help + sudo /opt/linupdate/linupdate --version + sudo /opt/linupdate/linupdate --check-updates + sudo /opt/linupdate/linupdate --profile container + sudo /opt/linupdate/linupdate --env test + sudo /opt/linupdate/linupdate --mod-enable reposerver + sudo /opt/linupdate/linupdate --mod-configure reposerver --url https://packages.bespin.ovh --fail-level 3 + sudo /opt/linupdate/linupdate --mod-configure reposerver --api-key ${{ secrets.REPOSITORY_TOKEN }} --register + sudo /opt/linupdate/linupdate --mod-configure reposerver --send-full-status + sudo /opt/linupdate/linupdate --mod-configure reposerver --unregister diff --git a/.github/workflows/build-rpm.yml b/.github/workflows/build-rpm.yml index 12df7b7..e9f04a9 100644 --- a/.github/workflows/build-rpm.yml +++ b/.github/workflows/build-rpm.yml @@ -101,6 +101,163 @@ jobs: path: /tmp/linupdate-test-build-${{ env.VERSION }}.noarch.rpm retention-days: 1 + # Try to install packages on CentOS 7 + install-centos7: + name: Install on CentOS 7 + needs: + build-rpm + runs-on: ubuntu-latest + container: + image: centos:7 + options: --user root + env: + # Force to use node16 (for actions/checkout@v3) + ACTIONS_RUNNER_FORCE_ACTIONS_NODE_VERSION: node16 + ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Get linupdate version + run: echo "VERSION=$(cat ${GITHUB_WORKSPACE}/version)" >> $GITHUB_ENV + + - name: Install CentOS7 archive repositories + run: | + rm /etc/yum.repos.d/* -f + + echo "[os] + name=os repo + baseurl=https://vault.centos.org/7.9.2009/os/x86_64/ + enabled=1 + gpgkey=https://vault.centos.org/RPM-GPG-KEY-CentOS-7 + gpgcheck=1" > /etc/yum.repos.d/os.repo + + echo "[extras] + name=extras repo + baseurl=https://vault.centos.org/7.9.2009/extras/x86_64/ + enabled=1 + gpgkey=https://vault.centos.org/RPM-GPG-KEY-CentOS-7 + gpgcheck=1" > /etc/yum.repos.d/extras.repo + + echo "[updates] + name=updates repo + baseurl=https://vault.centos.org/7.9.2009/updates/x86_64/ + enabled=1 + gpgkey=https://vault.centos.org/RPM-GPG-KEY-CentOS-7 + gpgcheck=1" > /etc/yum.repos.d/updates.repo + + echo "[epel] + name=epel repo + baseurl=https://dl.fedoraproject.org/pub/epel/7/x86_64/ + enabled=1 + gpgkey=https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-7 + gpgcheck=1" > /etc/yum.repos.d/epel.repo + + yum clean all + + # Download builded deb package artifact + - name: Download artifact + uses: actions/download-artifact@v3 + with: + name: linupdate-test-build-${{ env.VERSION }}.noarch.rpm + + - name: Install package + run: yum --nogpgcheck localinstall -y ./linupdate-test-build-${{ env.VERSION }}.noarch.rpm + + - name: Test some params + run: | + /opt/linupdate/linupdate --help + /opt/linupdate/linupdate --version + /opt/linupdate/linupdate --check-updates + /opt/linupdate/linupdate --profile container + /opt/linupdate/linupdate --env test + /opt/linupdate/linupdate --mod-enable reposerver + /opt/linupdate/linupdate --mod-configure reposerver --url https://packages.bespin.ovh --fail-level 3 + /opt/linupdate/linupdate --mod-configure reposerver --api-key ${{ secrets.REPOSITORY_TOKEN }} --register + /opt/linupdate/linupdate --mod-configure reposerver --send-full-status + /opt/linupdate/linupdate --mod-configure reposerver --unregister + + # Try to install packages on RockyLinux 8 + install-rockylinux8: + name: Install on RockyLinux 8 + needs: + build-rpm + runs-on: ubuntu-latest + container: + image: rockylinux/rockylinux:8 + options: --user root + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Get linupdate version + run: echo "VERSION=$(cat ${GITHUB_WORKSPACE}/version)" >> $GITHUB_ENV + + - name: Install EPEL repository + run: dnf install epel-release glibc-langpack-en -y + + # Download builded deb package artifact + - name: Download artifact + uses: actions/download-artifact@v3 + with: + name: linupdate-test-build-${{ env.VERSION }}.noarch.rpm + + - name: Install package + run: yum --nogpgcheck localinstall -y ./linupdate-test-build-${{ env.VERSION }}.noarch.rpm + + - name: Test some params + run: | + /opt/linupdate/linupdate --help + /opt/linupdate/linupdate --version + /opt/linupdate/linupdate --check-updates + /opt/linupdate/linupdate --profile container + /opt/linupdate/linupdate --env test + /opt/linupdate/linupdate --mod-enable reposerver + /opt/linupdate/linupdate --mod-configure reposerver --url https://packages.bespin.ovh --fail-level 3 + /opt/linupdate/linupdate --mod-configure reposerver --api-key ${{ secrets.REPOSITORY_TOKEN }} --register + /opt/linupdate/linupdate --mod-configure reposerver --send-full-status + /opt/linupdate/linupdate --mod-configure reposerver --unregister + + # Try to install packages on RockyLinux 9 + install-rockylinux9: + name: Install on RockyLinux 9 + needs: + build-rpm + runs-on: ubuntu-latest + container: + image: rockylinux/rockylinux:9 + options: --user root + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Get linupdate version + run: echo "VERSION=$(cat ${GITHUB_WORKSPACE}/version)" >> $GITHUB_ENV + + - name: Install EPEL repository + run: dnf install epel-release glibc-langpack-en -y + + # Download builded deb package artifact + - name: Download artifact + uses: actions/download-artifact@v3 + with: + name: linupdate-test-build-${{ env.VERSION }}.noarch.rpm + + - name: Install package + run: yum --nogpgcheck localinstall -y ./linupdate-test-build-${{ env.VERSION }}.noarch.rpm + + - name: Test some params + run: | + /opt/linupdate/linupdate --help + /opt/linupdate/linupdate --version + /opt/linupdate/linupdate --check-updates + /opt/linupdate/linupdate --profile container + /opt/linupdate/linupdate --env test + /opt/linupdate/linupdate --mod-enable reposerver + /opt/linupdate/linupdate --mod-configure reposerver --url https://packages.bespin.ovh --fail-level 3 + /opt/linupdate/linupdate --mod-configure reposerver --api-key ${{ secrets.REPOSITORY_TOKEN }} --register + /opt/linupdate/linupdate --mod-configure reposerver --send-full-status + /opt/linupdate/linupdate --mod-configure reposerver --unregister # Try to install packages on latest Fedora install-fedora: @@ -118,6 +275,9 @@ jobs: - name: Get linupdate version run: echo "VERSION=$(cat ${GITHUB_WORKSPACE}/version)" >> $GITHUB_ENV + - name: Install dependencies packages + run: dnf install glibc-langpack-en hostname -y + # Download builded deb package artifact - name: Download artifact uses: actions/download-artifact@v3 @@ -125,7 +285,17 @@ jobs: name: linupdate-test-build-${{ env.VERSION }}.noarch.rpm - name: Install package + run: dnf --nogpgcheck localinstall -y ./linupdate-test-build-${{ env.VERSION }}.noarch.rpm + + - name: Test some params run: | - dnf update -y - dnf clean all - dnf --nogpgcheck localinstall -y ./linupdate-test-build-${{ env.VERSION }}.noarch.rpm + /opt/linupdate/linupdate --help + /opt/linupdate/linupdate --version + /opt/linupdate/linupdate --check-updates + /opt/linupdate/linupdate --profile container + /opt/linupdate/linupdate --env test + /opt/linupdate/linupdate --mod-enable reposerver + /opt/linupdate/linupdate --mod-configure reposerver --url https://packages.bespin.ovh --fail-level 3 + /opt/linupdate/linupdate --mod-configure reposerver --api-key ${{ secrets.REPOSITORY_TOKEN }} --register + /opt/linupdate/linupdate --mod-configure reposerver --send-full-status + /opt/linupdate/linupdate --mod-configure reposerver --unregister diff --git a/.github/workflows/packaging/deb/control b/.github/workflows/packaging/deb/control index 5606d29..19d4ed8 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, dnsutils, locales-all +Depends: curl, 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 1098ea7..9c695d2 100644 --- a/.github/workflows/packaging/rpm/spec +++ b/.github/workflows/packaging/rpm/spec @@ -8,7 +8,6 @@ License: GPL-3.0 URL: https://github.com/lbr38/linupdate Requires: curl -Requires: git Requires: mutt Requires: ngrep Requires: inotify-tools diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 46ca6bd..6fb1c94 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -198,7 +198,7 @@ jobs: release_name: ${{ env.VERSION }} body: | **Changes**: - + - Added support for RHEL 8/9 based OS draft: false prerelease: false diff --git a/README.md b/README.md index 1d3b07e..bd7034d 100644 --- a/README.md +++ b/README.md @@ -60,7 +60,6 @@ It should help you **installing** and starting using linupdate. --ignore-exclude|-ie → Ignore all packages minor or major release update exclusions Modules - --list-modules|--list-mod|-m → List available modules --mod-enable|-mod-enable|-me MODULE → Enable specified module --mod-disable|-mod-disable|-md MODULE → Disable specified module --mod-configure|-mc|--mod-exec MODULE → Configure specified module (using module commands, see module help or documentation) diff --git a/linupdate b/linupdate index 258458b..73e262c 100755 --- a/linupdate +++ b/linupdate @@ -213,10 +213,6 @@ while [ $# -ge 1 ];do fi clean_exit ;; - --list-modules|--list-mod|-m) - listModules - clean_exit - ;; --ignore-exclude|-ie) IGNORE_EXCLUDE=1 ;; diff --git a/mods-available/configurations/reposerver.conf b/mods-available/configurations/reposerver.conf index b0457c9..4dfb8d7 100644 --- a/mods-available/configurations/reposerver.conf +++ b/mods-available/configurations/reposerver.conf @@ -4,8 +4,8 @@ FAILLEVEL="" [CLIENT] ID="" TOKEN="" -GET_PROFILE_PKG_CONF_FROM_REPOSERVER="" -GET_PROFILE_REPOS_FROM_REPOSERVER="" +GET_PROFILE_PKG_CONF_FROM_REPOSERVER="true" +GET_PROFILE_REPOS_FROM_REPOSERVER="true" [REPOSERVER] IP="" diff --git a/mods-available/reposerver.mod b/mods-available/reposerver.mod index b293ab1..27435b1 100644 --- a/mods-available/reposerver.mod +++ b/mods-available/reposerver.mod @@ -216,7 +216,7 @@ function mod_help echo -e " --get-profile-repos → Get repos sources configuration from reposerver." echo -e " --send-general-status → Send host global informations to reposerver (OS, version, kernel..)" echo -e " --send-full-history → Send host packages events history to reposerver (installation, update, uninstallation...)" - echo -e " --send-packages-status → Send host packages informations (installed, available...) to resposerver" + echo -e " --send-packages-status → Send host packages informations (installed, available) to reposerver" echo -e " --send-full-status → Execute the tree previous parameters" echo -e "" echo -e " Agent:" @@ -375,7 +375,7 @@ function mod_configure sed -i "s/FAILLEVEL=.*/FAILLEVEL=\"$FAILLEVEL\"/g" $MOD_CONF fi ;; - --allow-conf-update) + --allow-conf-update|--get-packages-conf-from-reposerver) if [ "$2" == "yes" ];then GET_PROFILE_PKG_CONF_FROM_REPOSERVER="true" else @@ -390,7 +390,7 @@ function mod_configure sed -i "s/GET_PROFILE_PKG_CONF_FROM_REPOSERVER=.*/GET_PROFILE_PKG_CONF_FROM_REPOSERVER=\"$GET_PROFILE_PKG_CONF_FROM_REPOSERVER\"/g" $MOD_CONF fi ;; - --allow-repos-update) + --allow-repos-update|--get-repos-from-reposerver) if [ "$2" == "yes" ];then GET_PROFILE_REPOS_FROM_REPOSERVER="true" else @@ -602,7 +602,6 @@ function getModConf # Configuration serveur (section [REPOSERVER]) REPOSERVER_URL="$(grep "^URL=" $MOD_CONF | cut -d'=' -f2 | sed 's/"//g')" - REPOSERVER_PACKAGE_TYPE="$(grep "^PACKAGE_TYPE=" $MOD_CONF | cut -d'=' -f2 | sed 's/"//g')" # Récupération du FAILLEVEL pour ce module FAILLEVEL=$(grep "^FAILLEVEL=" "$MOD_CONF" | cut -d'=' -f2 | sed 's/"//g') @@ -657,7 +656,6 @@ function getServerConf REPOSERVER_IP=$(_jq '.Ip') REPOSERVER_URL=$(_jq '.Url') - REPOSERVER_PACKAGE_TYPE=$(_jq '.Package_type') done # Retrieve the server IP address from the server URL @@ -695,7 +693,7 @@ function getServerConf echo "[REPOSERVER]" >> "$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 "PACKAGE_TYPE=\"\"" >> "$TMP_FILE_REPOSERVER" echo "" >> "$TMP_FILE_REPOSERVER" # On reconstruit le fichier de configuration @@ -720,11 +718,7 @@ function getServerConf # Fonction exécutée pre-mise à jour function preCheck { - # Vérification que le serveur Repomanager gère le même type de paquet que cet hôte - if ! echo "$REPOSERVER_PACKAGE_TYPE" | grep -q "$PKG_TYPE";then - echo -e " [${YELLOW} ERROR ${RESET}] reposerver do not handle the same package type as this host. Reposerver: $REPOSERVER_PACKAGE_TYPE / Host: $PKG_TYPE" - return 2 - fi + return } # Get profile general configuration from reposerver @@ -1220,7 +1214,11 @@ function send_installed_packages_status # Construction de la liste des paquets # Cas Redhat if [ "$OS_FAMILY" == "Redhat" ];then - repoquery -a --installed --qf="%{name} %{epoch}:%{version}-%{release}.%{arch}" > "$INSTALLED_PACKAGES_TMP" + if [ -f "/usr/bin/dnf" ];then + dnf repoquery -q -a --installed --qf="%{name} %{epoch}:%{version}-%{release}.%{arch}" > "$INSTALLED_PACKAGES_TMP" + else + repoquery -a --installed --qf="%{name} %{epoch}:%{version}-%{release}.%{arch}" > "$INSTALLED_PACKAGES_TMP" + fi fi # Cas Debian if [ "$OS_FAMILY" == "Debian" ];then @@ -1290,7 +1288,11 @@ function send_available_packages_status # Cas Redhat if [ "$OS_FAMILY" == "Redhat" ];then # Récupération des paquets disponibles pour mise à jour - repoquery -q -a --qf="%{name} %{epoch}:%{version}-%{release}.%{arch}" --pkgnarrow=updates > "$AVAILABLE_PACKAGES_TMP" + if [ -f "/usr/bin/dnf" ];then + dnf repoquery -q --upgrades --latest-limit 1 -a --qf="%{name} %{epoch}:%{version}-%{release}.%{arch}" --upgrades > "$AVAILABLE_PACKAGES_TMP" + else + repoquery -a --qf="%{name} %{epoch}:%{version}-%{release}.%{arch}" --pkgnarrow=updates > "$AVAILABLE_PACKAGES_TMP" + fi fi # Cas Debian if [ "$OS_FAMILY" == "Debian" ];then @@ -1389,10 +1391,18 @@ function genFullHistory # Récupération de tous les ID d'évènements dans la base de données de yum if [ "$HISTORY_START" == "newest" ];then - YUM_HISTORY_IDS=$(yum history list all | tail -n +4 | awk '{print $1}' | grep -v "history") + if [ -f "/usr/bin/dnf" ];then + YUM_HISTORY_IDS=$(dnf history list | tail -n +3 | awk '{print $1}' | grep -v "history") + else + YUM_HISTORY_IDS=$(yum history list all | tail -n +4 | awk '{print $1}' | grep -v "history") + fi fi if [ "$HISTORY_START" == "oldest" ];then - YUM_HISTORY_IDS=$(yum history list all | tail -n +4 | awk '{print $1}' | grep -v "history" | tac) + if [ -f "/usr/bin/dnf" ];then + YUM_HISTORY_IDS=$(dnf history list | tail -n +3 | awk '{print $1}' | grep -v "history" | tac) + else + YUM_HISTORY_IDS=$(yum history list all | tail -n +4 | awk '{print $1}' | grep -v "history" | tac) + fi fi # Pour chaque évènement on peut récupérer la date et l'heure de début et la date et l'heure de fin diff --git a/src/00_get-modules b/src/00_get-modules deleted file mode 100644 index 556cb26..0000000 --- a/src/00_get-modules +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env bash -# Récupérer les modules à jour depuis github - -function getModules -{ - TMP_DIR="/tmp/linupdate" - rm "$TMP_DIR" -rf - - # Clonage du repo - cd /tmp && - git clone --quiet https://github.com/lbr38/linupdate.git > /dev/null && - - # Copie de tous les modules dans le répertoire de modules - \cp -r ${TMP_DIR}/mods-available/* ${MODULES_DIR}/ && - rm "$TMP_DIR" -rf -} \ No newline at end of file diff --git a/src/00_list-modules b/src/00_list-modules deleted file mode 100644 index 4a22005..0000000 --- a/src/00_list-modules +++ /dev/null @@ -1,37 +0,0 @@ -#!/usr/bin/env bash -# Voir la liste des modules - -function listModules -{ - # Récupération de tous les modules à jour depuis github - getModules - - ENABLED_MODULES=() - - # Affiche les modules activés - echo -e "\n Enabled modules:" - if [ "$(ls -A $MODULES_ENABLED_DIR)" ];then - for MODULE in $(ls -A1 "${MODULES_ENABLED_DIR}/"*.mod);do - MODULE=$(basename $MODULE) - MODULE=${MODULE%.mod} - echo -e " $GREEN $MODULE $RESET" - - ENABLED_MODULES+=("$MODULE") - done - else - echo " No module enabled" - fi - - # Affiche les modules disponibles (qui ne sont pas dans ENABLED_MODULES) - echo -e "\n Available modules:" - if [ "$(ls -A $MODULES_DIR)" ];then - for MODULE in $(ls -A1 "${MODULES_DIR}/"*.mod);do - MODULE=$(basename $MODULE) - MODULE=${MODULE%.mod} - if [[ ! ${ENABLED_MODULES[*]} =~ "$MODULE" ]]; then - MODULE=$(basename $MODULE | sed 's/.mod//g') - echo -e " $YELLOW $MODULE $RESET" - fi - done - fi -} \ No newline at end of file diff --git a/src/02_check-packages-before-update b/src/02_check-packages-before-update index 17370ae..9a1db23 100644 --- a/src/02_check-packages-before-update +++ b/src/02_check-packages-before-update @@ -14,15 +14,17 @@ function checkPackagesBeforeUpdate apt-get clean && apt-get -qq --allow-releaseinfo-change update fi + echo -e "\n Generating packages list..." + # Temporary file to work with CHECK_UPDATE_TMP="/tmp/linupdate_check-update.tmp" # List packages available for update if [ "$OS_FAMILY" == "Redhat" ];then if [ -f "/usr/bin/dnf" ];then - repoquery -q -a --qf="%{name} %{version}-%{release}.%{arch} %{repoid}" --upgrades >> "$CHECK_UPDATE_TMP" + dnf repoquery -q --upgrades --latest-limit 1 -a --qf="%{name} %{version}-%{release}.%{arch} %{repoid}" --upgrades >> "$CHECK_UPDATE_TMP" else - repoquery -q -a --qf="%{name} %{version}-%{release}.%{arch} %{repoid}" --pkgnarrow=updates > "$CHECK_UPDATE_TMP" + repoquery -a --qf="%{name} %{version}-%{release}.%{arch} %{repoid}" --pkgnarrow=updates > "$CHECK_UPDATE_TMP" fi fi if [ "$OS_FAMILY" == "Debian" ];then diff --git a/src/200_yum-history-parser b/src/200_yum-history-parser index 478a031..5cda9f4 100644 --- a/src/200_yum-history-parser +++ b/src/200_yum-history-parser @@ -49,6 +49,12 @@ function yumHistoryParser if echo "$LINE" | egrep -q "^ +Install ";then PACKAGE_NAME=$(echo "$LINE" | awk '{print $2}' | sed 's/-[0-9].*//g') + + # If package name starts with '@', ignore it as it's a group + if echo "$PACKAGE_NAME" | grep -q "^@";then + continue + fi + PACKAGE_VERSION=$(echo "$LINE" | awk '{print $2}' | sed "s/$PACKAGE_NAME//g" | sed 's/^-//g') REPO=$(echo "$LINE" | awk '{print $3}') PACKAGES_INSTALLED_JSON+="{\"name\":\"$PACKAGE_NAME\",\"version\":\"$PACKAGE_VERSION\",\"repo\":\"$REPO\"}," @@ -56,6 +62,12 @@ function yumHistoryParser if echo "$LINE" | egrep -q "^ +Dep-Install ";then PACKAGE_NAME=$(echo "$LINE" | awk '{print $2}' | sed 's/-[0-9].*//g') + + # If package name starts with '@', ignore it as it's a group + if echo "$PACKAGE_NAME" | grep -q "^@";then + continue + fi + PACKAGE_VERSION=$(echo "$LINE" | awk '{print $2}' | sed "s/$PACKAGE_NAME//g" | sed 's/^-//g') REPO=$(echo "$LINE" | awk '{print $3}') DEPENDENCIES_INSTALLED_JSON+="{\"name\":\"$PACKAGE_NAME\",\"version\":\"$PACKAGE_VERSION\",\"repo\":\"$REPO\"}," @@ -66,6 +78,12 @@ function yumHistoryParser # Sinon on ignore cette ligne if grep -A1 "^${LINE}" "$TMP_EVENT_FILE" | grep -v "$LINE" | awk '{print $2}' | grep -q "^[0-9]";then PACKAGE_NAME=$(echo "$LINE" | awk '{print $2}' | sed 's/-[0-9].*//g') + + # If package name starts with '@', ignore it as it's a group + if echo "$PACKAGE_NAME" | grep -q "^@";then + continue + fi + PACKAGE_VERSION=$(grep -A1 "^${LINE}" "$TMP_EVENT_FILE" | grep -v "$LINE" | awk '{print $2}') REPO=$(grep -A1 "^${LINE}" "$TMP_EVENT_FILE" | grep -v "$LINE" | awk '{print $3}') PACKAGES_UPGRADED_JSON+="{\"name\":\"$PACKAGE_NAME\",\"version\":\"$PACKAGE_VERSION\",\"repo\":\"$REPO\"}," @@ -74,18 +92,36 @@ function yumHistoryParser if echo "$LINE" | egrep -q "^ +Erase ";then PACKAGE_NAME=$(echo "$LINE" | awk '{print $2}' | sed 's/-[0-9].*//g') + + # If package name starts with '@', ignore it as it's a group + if echo "$PACKAGE_NAME" | grep -q "^@";then + continue + fi + PACKAGE_VERSION=$(echo "$LINE" | awk '{print $2}' | sed "s/$PACKAGE_NAME//g" | sed 's/^-//g') PACKAGES_REMOVED_JSON+="{\"name\":\"$PACKAGE_NAME\",\"version\":\"$PACKAGE_VERSION\"}," fi if echo "$LINE" | egrep -q "^ +Downgrade ";then PACKAGE_NAME=$(echo "$LINE" | awk '{print $2}' | sed 's/-[0-9].*//g') + + # If package name starts with '@', ignore it as it's a group + if echo "$PACKAGE_NAME" | grep -q "^@";then + continue + fi + PACKAGE_VERSION=$(echo "$LINE" | awk '{print $2}' | sed "s/$PACKAGE_NAME//g" | sed 's/^-//g') PACKAGES_DOWNGRADED_JSON+="{\"name\":\"$PACKAGE_NAME\",\"version\":\"$PACKAGE_VERSION\"}," fi if echo "$LINE" | egrep -q "^ +Reinstall ";then PACKAGE_NAME=$(echo "$LINE" | awk '{print $2}' | sed 's/-[0-9].*//g') + + # If package name starts with '@', ignore it as it's a group + if echo "$PACKAGE_NAME" | grep -q "^@";then + continue + fi + PACKAGE_VERSION=$(echo "$LINE" | awk '{print $2}' | sed "s/$PACKAGE_NAME//g" | sed 's/^-//g') REPO=$(echo "$LINE" | awk '{print $3}') PACKAGES_REINSTALLED_JSON+="{\"name\":\"$PACKAGE_NAME\",\"version\":\"$PACKAGE_VERSION\",\"repo\":\"$REPO\"}," diff --git a/version b/version index 14f2967..070bdbb 100644 --- a/version +++ b/version @@ -1 +1 @@ -2.2.14 \ No newline at end of file +2.2.15 \ No newline at end of file