Skip to content

Commit

Permalink
Add a safe-guard to the test-image setup script
Browse files Browse the repository at this point in the history
The setup can do any number of dangerous things like nuking parts of
your system, make sure nobody accidentally runs it by placing a flag
file from make_install and checking on setup.sh.
  • Loading branch information
pmatilai authored and dmnks committed Feb 3, 2025
1 parent 07b34a0 commit 147de53
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tests/mktree.common
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,6 @@ make_install()
mkdir -p $DESTDIR/$script_dir
cp rpmtests atlocal mktree.common setup.sh $DESTDIR/$script_dir/
cp @CMAKE_CURRENT_SOURCE_DIR@/rpmtests.sh $DESTDIR/$script_dir/

touch $DESTDIR/.rpmtestsuite
}
6 changes: 6 additions & 0 deletions tests/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
# Setup the environment in the test-image.
# Runs INSIDE the image, with our newly built rpm in the path.

# Make sure nobody runs this accidentally outside the environment
if [ ! -f /.rpmtestsuite ]; then
echo "Not inside rpm test-suite image"
exit 99
fi

mkdir -p /build
ln -sf ../data/SOURCES /build/

Expand Down

0 comments on commit 147de53

Please sign in to comment.