airgap/rootfs/usr/local/bin/autorun

28 lines
920 B
Plaintext
Raw Normal View History

2020-08-12 03:23:25 +00:00
#!/bin/bash
set -e
source /etc/profile
folder=${1?}
echo "Checking autorun in folder: ${folder}" >/dev/console
# Check if the folder is /media/USER and has autorun.sh
if [ "$folder" == "/media/USER" ] && [ -f "${folder}/autorun.sh" ]; then
echo "" >/dev/console
echo "++ Autorun: Found /media/USER/autorun.sh" >/dev/console;
echo "** Autorun: Executing /media/USER/autorun.sh" >/dev/console
/bin/bash "/media/USER/autorun.sh" >/dev/console
elif [ -f "${folder}/autorun.sh.asc" ]; then
2020-08-13 05:26:07 +00:00
echo "" >/dev/console
2020-08-12 03:23:25 +00:00
echo "++ Autorun: Found ${folder}/autorun.sh" >/dev/console;
2020-08-13 05:26:07 +00:00
gpg --verify "${folder}/autorun.sh.asc" >/dev/null 2>&1 || {
2020-08-12 03:23:25 +00:00
echo "!! Autorun: Verification Failed for ${folder}/autorun.sh" \
>/dev/console;
exit 1;
}
echo "++ Autorun: Verified ${folder}/autorun.sh" >/dev/console
echo "** Autorun: Executing ${folder}/autorun.sh" >/dev/console
/bin/bash "${folder}/autorun.sh" >/dev/console
fi