Updated setup script (chatgpt-aided)
This commit is contained in:
parent
9a8a646c53
commit
32b12536de
60
setup.sh
60
setup.sh
|
@ -1,18 +1,54 @@
|
|||
#!/bin/bash
|
||||
|
||||
if [ $1 == "--gentmpl" ]; then
|
||||
install_packages_managed() {
|
||||
packages=("python3-dotenv" "python3-requests" "python3-lxml")
|
||||
sudo apt install "${packages[@]}"
|
||||
}
|
||||
|
||||
install_packages_unmanaged() {
|
||||
# General packages
|
||||
general_packages=("python-dotenv")
|
||||
|
||||
# Stasher packages
|
||||
stasher_packages=("requests" "lxml" "python-dotenv")
|
||||
|
||||
pip3 install "${general_packages[@]}"
|
||||
pip3 install "${stasher_packages[@]}"
|
||||
}
|
||||
|
||||
print_usage() {
|
||||
echo "Usage: $0 [OPTIONS]"
|
||||
echo "Options:"
|
||||
echo " --gentmpl Generate .env template"
|
||||
echo " --managed Install managed python packages"
|
||||
echo " --unmanaged Install unmanaged python packages"
|
||||
}
|
||||
|
||||
while getopts ":h" opt; do
|
||||
case $opt in
|
||||
h)
|
||||
print_usage
|
||||
exit 0
|
||||
;;
|
||||
\?)
|
||||
echo "Invalid option: -$OPTARG"
|
||||
print_usage
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
shift $((OPTIND - 1))
|
||||
|
||||
if [[ $1 == "--gentmpl" ]]; then
|
||||
grep "[A-Z_ ]*=" .env -o > env-template.txt
|
||||
exit 0
|
||||
elif [ ! -z "$1" ]; then
|
||||
echo "Unrecognised parameter, use --gentmpl to generate .env template"
|
||||
elif [[ $1 == "--managed" ]]; then
|
||||
install_packages_managed
|
||||
elif [[ $1 == "--unmanaged" ]]; then
|
||||
install_packages_unmanaged
|
||||
else
|
||||
echo "Unrecognized parameter."
|
||||
print_usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Installs prerequisites for some of the system scripts
|
||||
# Redundant package names are acceptable as this improves readability
|
||||
|
||||
# General
|
||||
python -m pip install python-dotenv
|
||||
|
||||
# Stasher
|
||||
python -m pip install requests lxml python-dotenv
|
||||
|
|
Loading…
Reference in New Issue