fix: don't run arbitrary commands with script

* scripts are now called with their absolute paths instead of ./
This commit is contained in:
ER
2023-08-13 18:36:49 +03:00
parent bbb1cc8b88
commit dc97fa4201
2 changed files with 9 additions and 9 deletions

View File

@@ -5,16 +5,16 @@ image-version: 38
modules: modules:
- type: script - type: script
run: # commands directly run inside scripts directory scripts:
- ./autorun.sh pre - autorun.sh pre
- from-file: common-packages.yml # paths relative to "config" directory - from-file: common-packages.yml # paths relative to "config" directory
- type: script - type: script
run: scripts:
# this sets up the proper policy & signing files for signed images to work # this sets up the proper policy & signing files for signed images to work
- ./signing.sh - signing.sh
- ./autorun.sh post - autorun.sh post
- type: yafti # no need for an enable-disable key, inclusion implicitly enables - type: yafti # no need for an enable-disable key, inclusion implicitly enables

View File

@@ -3,13 +3,13 @@
# Tell build process to exit if there are any errors. # Tell build process to exit if there are any errors.
set -oue pipefail set -oue pipefail
get_yaml_array RUN '.run[]' "$1" get_yaml_array SCRIPTS '.scripts[]' "$1"
cd "$CONFIG_DIRECTORY/scripts" cd "$CONFIG_DIRECTORY/scripts"
find "$PWD" -type f -exec chmod +x {} \; find "$PWD" -type f -exec chmod +x {} \;
for CMD in "${RUN[@]}"; do for SCRIPT in "${SCRIPTS[@]}"; do
echo "Running command: $CMD" echo "Running script $SCRIPT"
eval "$CMD" eval "$PWD/$SCRIPT"
done done