55 lines
1.2 KiB
Bash
Executable File
55 lines
1.2 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
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 [[ $1 == "--managed" ]]; then
|
|
install_packages_managed
|
|
elif [[ $1 == "--unmanaged" ]]; then
|
|
install_packages_unmanaged
|
|
else
|
|
echo "Unrecognized parameter."
|
|
print_usage
|
|
exit 1
|
|
fi
|