forked from public/airgap
29 lines
968 B
Bash
Executable File
29 lines
968 B
Bash
Executable File
#!/bin/bash
|
|
set -e
|
|
source /etc/profile
|
|
|
|
folder=${1?}
|
|
|
|
if [ "$folder" == "/media/USER" ] && [ -f "${folder}/autorun.sh" ]; then
|
|
if touch "${folder}/.write_test" 2>/dev/null; then
|
|
echo "!! Autorun: Read-only verification failed for /media/USER" >/dev/console
|
|
exit 1;
|
|
else
|
|
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
|
|
fi
|
|
elif [ -f "${folder}/autorun.sh.asc" ]; then
|
|
echo "" >/dev/console
|
|
echo "++ Autorun: Found ${folder}/autorun.sh" >/dev/console;
|
|
gpg --verify "${folder}/autorun.sh.asc" >/dev/null 2>&1 || {
|
|
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
|