Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions rust/package/agama.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
-------------------------------------------------------------------
Thu Mar 20 09:05:26 UTC 2025 - Imobach Gonzalez Sosa <igonzalezsosa@suse.com>

- 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 <igonzalezsosa@suse.com>

Expand Down
24 changes: 13 additions & 11 deletions rust/share/agama-scripts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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