diff --git a/linux/python/new-uuid.py b/linux/python/new-uuid.py new file mode 100644 index 0000000..8f7c232 --- /dev/null +++ b/linux/python/new-uuid.py @@ -0,0 +1,2 @@ +import uuid +print(uuid.uuid4()) diff --git a/linux/setup/setup_uuid.sh b/linux/setup/setup_uuid.sh new file mode 100755 index 0000000..9226f07 --- /dev/null +++ b/linux/setup/setup_uuid.sh @@ -0,0 +1,26 @@ +#!/bin/bash +cmd_name="new-uuid" +script_fn="new-uuid.py" + +# Re-run the script as root if we're not +if [ "$EUID" != 0 ]; then + sudo "$0" "$@" + exit $? +fi + +echo "Setting up $cmd_name" +if ! command -v /usr/bin/python3 2>&1 >/dev/null +then + echo "/usr/bin/python3 does not exist! Please install it before continuing..." + exit 1 +fi + +mkdir -p /opt/scripts +cp "../python/$script_fn" "/opt/scripts/$script_fn" + +# Create executable as a script, install to local/bin +echo "/usr/bin/python3 /opt/scripts/$script_fn \"\$@\"" > $cmd_name +chmod +x $cmd_name +mv $cmd_name /usr/local/bin + +echo "Done! Try the command '$cmd_name' to see the effects!"