Skip to content

Commit

Permalink
core: tools: scripts: red-pill: Add option to select user
Browse files Browse the repository at this point in the history
Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
  • Loading branch information
patrickelectric committed Dec 22, 2023
1 parent f84717e commit bf91a66
Showing 1 changed file with 40 additions and 1 deletion.
41 changes: 40 additions & 1 deletion core/tools/scripts/red-pill
Original file line number Diff line number Diff line change
@@ -1,5 +1,44 @@
#!/bin/bash

usage() {
echo "Usage: $0 [-h] [-u user]"
echo
echo " -h, Show this help message"
echo " -u, Define a user (default: pi)"
exit 1
}

# Default values
user="pi"

while getopts ":hu:" opt; do
case ${opt} in
h )
usage
;;
u )
user=$OPTARG
;;
\? )
echo "Invalid Option: -$OPTARG" 1>&2
usage
;;
: )
echo "Invalid Option: -$OPTARG requires an argument" 1>&2
usage
;;
esac
done
shift $((OPTIND -1))

# Don't simply ignore additional arguments
if [ $# -gt 0 ]; then
echo "Invalid Argument: $1" 1>&2
usage
fi

echo "You took the red pill."
echo "You stay in Wonderland, and I show you how deep the rabbit hole goes."
echo "Remember, all I'm offering is the truth. Nothing more."
echo "Exiting from docker, welcome to the real world."
ssh -i /root/.config/.ssh/id_rsa -o StrictHostKeyChecking=no pi@localhost
ssh -i /root/.config/.ssh/id_rsa -o StrictHostKeyChecking=no $user@localhost

0 comments on commit bf91a66

Please sign in to comment.