Skip to content

Commit

Permalink
Merge pull request #52 from lbr38/devel
Browse files Browse the repository at this point in the history
2.2.13
  • Loading branch information
lbr38 authored Feb 13, 2024
2 parents 8c5b5ed + ed987ee commit 5e8cc75
Show file tree
Hide file tree
Showing 33 changed files with 56 additions and 38 deletions.
22 changes: 11 additions & 11 deletions .github/workflows/build-deb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand All @@ -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
Expand All @@ -60,13 +60,13 @@ jobs:
run: |
cd /tmp
dpkg-deb --build linupdate-build
mv /tmp/linupdate-build.deb /tmp/linupdate-test-build_${{ env.VERSION }}.deb
mv /tmp/linupdate-build.deb /tmp/linupdate-test-build_${{ env.VERSION }}_all.deb
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: linupdate-test-build_${{ env.VERSION }}.deb
path: /tmp/linupdate-test-build_${{ env.VERSION }}.deb
name: linupdate-test-build_${{ env.VERSION }}_all.deb
path: /tmp/linupdate-test-build_${{ env.VERSION }}_all.deb
retention-days: 1

# Try to install package on Debian 10
Expand All @@ -89,12 +89,12 @@ jobs:
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: linupdate-test-build_${{ env.VERSION }}.deb
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 }}.deb
apt-get install -y ./linupdate-test-build_${{ env.VERSION }}_all.deb
# Try to install package on Debian 11
install-debian-11:
Expand All @@ -116,12 +116,12 @@ jobs:
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: linupdate-test-build_${{ env.VERSION }}.deb
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 }}.deb
apt-get install -y ./linupdate-test-build_${{ env.VERSION }}_all.deb
# Try to install package on Ubuntu (latest)
install-ubuntu:
Expand All @@ -140,9 +140,9 @@ jobs:
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: linupdate-test-build_${{ env.VERSION }}.deb
name: linupdate-test-build_${{ env.VERSION }}_all.deb

- name: Install package
run: |
sudo apt-get update -y
sudo apt-get install -y ./linupdate-test-build_${{ env.VERSION }}.deb
sudo apt-get install -y ./linupdate-test-build_${{ env.VERSION }}_all.deb
4 changes: 2 additions & 2 deletions .github/workflows/build-rpm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand All @@ -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
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/packaging/deb/postinst
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ fi
# Create a symlink to main script
ln -sf /opt/linupdate/linupdate /usr/bin/linupdate

# Delete old 'functions' directory if exists
if [ -d "$DATA_DIR/functions" ];then
rm -rf "$DATA_DIR/functions"
fi

# Install en_US.UTF-8 locale if not present
if ! locale -a | grep -q "en_US.UTF-8";then
apt-get install locales-all -y > /dev/null
Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/packaging/rpm/spec
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ if [ -f "/tmp/linupdate.conf.rpmsave" ];then
mv /tmp/linupdate.conf.rpmsave /etc/linupdate/linupdate.conf
fi

# Delete old 'functions' directory if exists
if [ -d "$DATA_DIR/functions" ];then
rm -rf "$DATA_DIR/functions"
fi

# Create a symlink to main script
ln -sf /opt/linupdate/linupdate /usr/bin/linupdate

Expand All @@ -79,8 +84,8 @@ if [ -f "/usr/bin/systemctl" ];then
fi

%files
/opt/linupdate/*
/etc/linupdate/*
/opt/linupdate/
/etc/linupdate/
/lib/systemd/system/linupdate.service

%changelog
20 changes: 10 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand All @@ -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
Expand All @@ -57,13 +57,13 @@ jobs:
run: |
cd /tmp
dpkg-deb --build linupdate-build
mv /tmp/linupdate-build.deb /tmp/linupdate_${{ env.VERSION }}.deb
mv /tmp/linupdate-build.deb /tmp/linupdate_${{ env.VERSION }}_all.deb
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: linupdate_${{ env.VERSION }}.deb
path: /tmp/linupdate_${{ env.VERSION }}.deb
name: linupdate_${{ env.VERSION }}_all.deb
path: /tmp/linupdate_${{ env.VERSION }}_all.deb
retention-days: 3

build-rpm:
Expand Down Expand Up @@ -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/
Expand All @@ -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
Expand Down Expand Up @@ -143,7 +143,7 @@ jobs:
- name: Download deb artifact
uses: actions/download-artifact@v3
with:
name: linupdate_${{ env.VERSION }}.deb
name: linupdate_${{ env.VERSION }}_all.deb
path: ~/assets

# Download builded rpm package artifact
Expand All @@ -163,9 +163,9 @@ jobs:
tag_name: ${{ env.VERSION }}
release_name: ${{ env.VERSION }}
body: |
**Features**:
**Fixes**:
- Restart a service after a specific package update
- **reposerver** module: fixed missing reposerver IP address in the configuration file
draft: false
prerelease: false

Expand Down
12 changes: 6 additions & 6 deletions linupdate
Original file line number Diff line number Diff line change
Expand Up @@ -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_DIR="${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
Expand Down Expand Up @@ -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
Expand Down
20 changes: 14 additions & 6 deletions mods-available/reposerver.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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"

Expand All @@ -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
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.2.12
2.2.13

0 comments on commit 5e8cc75

Please sign in to comment.