From 1dc1b4ce2b63a59bf149325bf8507d965bdaf19d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Imobach=20Gonz=C3=A1lez=20Sosa?= Date: Fri, 14 Mar 2025 17:40:52 -0400 Subject: [PATCH 1/3] fix(rust): run init scripts properly --- rust/share/agama-scripts.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust/share/agama-scripts.sh b/rust/share/agama-scripts.sh index 5cea7f922e..d3a16f5a53 100755 --- a/rust/share/agama-scripts.sh +++ b/rust/share/agama-scripts.sh @@ -41,5 +41,5 @@ fi for script in `find $WORKDIR -type f |sort`; do echo -n "Executing Agama auto-installation script: $script" BASENAME=`basename $script` - . $script > $WORKDIR/$BASENAME.log 2>&1 + ./"$script" > "$WORKDIR/$BASENAME.log" 2>&1 done From 889aac50eba0690044edf5d7fce29544cb16eb3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Imobach=20Gonz=C3=A1lez=20Sosa?= Date: Fri, 14 Mar 2025 18:01:45 -0400 Subject: [PATCH 2/3] fix(rust): make agama-scripts.sh idempotent * Allow setting the scripts path with the SCRIPTS_DIR environment variable. * Do not exit with an error if there are not scripts. --- rust/share/agama-scripts.sh | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/rust/share/agama-scripts.sh b/rust/share/agama-scripts.sh index d3a16f5a53..156ebc4207 100755 --- a/rust/share/agama-scripts.sh +++ b/rust/share/agama-scripts.sh @@ -22,24 +22,26 @@ # This script runs the user-defined Agama init scripts. -WORKDIR="/var/log/agama-installation/scripts/init" +: "${SCRIPTS_DIR:=/var/log/agama-installation/scripts/init}" systemctl disable agama-scripts.service -if [ ! -d "$WORKDIR" ]; then - exit 1 +if [ ! -d "$SCRIPTS_DIR" ]; then + exit 0 fi -for script in `find $WORKDIR -type f`; do - CONTINUE=1 -done +SCRIPTS=$(find "$SCRIPTS_DIR" -maxdepth 1 -type f | sort) -if [ -z "$CONTINUE" ]; then +if [ -z "$SCRIPTS" ]; then exit 0 fi -for script in `find $WORKDIR -type f |sort`; do - echo -n "Executing Agama auto-installation script: $script" - BASENAME=`basename $script` - ./"$script" > "$WORKDIR/$BASENAME.log" 2>&1 +LOG_DIR="$SCRIPTS_DIR/log" +mkdir -p "$LOG_DIR" + +IFS=' +' +for script in $SCRIPTS; do + BASENAME=$(basename "$script") + ./"$script" > "$LOG_DIR/$BASENAME.log" 2>&1 done From 180f0f347006fd93bc260075ae22d92b43eb5771 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Imobach=20Gonz=C3=A1lez=20Sosa?= Date: Thu, 20 Mar 2025 09:09:24 +0000 Subject: [PATCH 3/3] docs(rust): update changes file --- rust/package/agama.changes | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/rust/package/agama.changes b/rust/package/agama.changes index 8de95ce77a..f85a0c4e29 100644 --- a/rust/package/agama.changes +++ b/rust/package/agama.changes @@ -1,3 +1,13 @@ +------------------------------------------------------------------- +Thu Mar 20 09:05:26 UTC 2025 - Imobach Gonzalez Sosa + +- Improve init scripts execution (gh#agama-project/agama#2161): + * Properly run the scripts (gh#agama-project/agama#2144). + * Allow setting the scripts path with the SCRIPTS_DIR + environment variable. + * Do not exit with an error if there are not scripts. + * Make agama-scripts.sh idempotent. + ------------------------------------------------------------------- Fri Mar 14 12:32:42 UTC 2025 - Imobach Gonzalez Sosa