From 84cdf7bc0ad15148fa60ee7c47868934a8666928 Mon Sep 17 00:00:00 2001 From: Zen Date: Sun, 6 Mar 2022 13:22:12 -0600 Subject: [PATCH] make flask is working up to debug mode --- Makefile | 4 ++++ ingredients/copper | 2 ++ ingredients/iron | 2 -- ingredients/lead | 16 ++++++++++--- recipes/init.sh | 57 +++++++--------------------------------------- 5 files changed, 27 insertions(+), 54 deletions(-) diff --git a/Makefile b/Makefile index 3aa3af6..d174a15 100644 --- a/Makefile +++ b/Makefile @@ -31,6 +31,10 @@ prosperity: free: @echo "This will install freespace, once it exists" + +flask: + @chmod +x recipes/flask.sh + @recipes/flask.sh manifest: @chmod +x recipes/wordpress.sh diff --git a/ingredients/copper b/ingredients/copper index d4a517d..e7bfdf2 100644 --- a/ingredients/copper +++ b/ingredients/copper @@ -281,4 +281,6 @@ check_ports() { fi } +# TODO Expose ports via firewalld + # using yggdrasil could maybe fit in here diff --git a/ingredients/iron b/ingredients/iron index 891ac14..33fcab5 100644 --- a/ingredients/iron +++ b/ingredients/iron @@ -59,9 +59,7 @@ build_service_from_template() { read reset case $reset in "Y" | "y") - cat /etc/systemd/system/ sudo rm $SERVICE_FILE - cat /etc/systemd/system/ ;; "N" | "n") echo "Okay, we'll leave it as is." diff --git a/ingredients/lead b/ingredients/lead index 336b6ca..7ec1159 100644 --- a/ingredients/lead +++ b/ingredients/lead @@ -121,6 +121,14 @@ source_env check_for() { command -v "$1" >/dev/null } +if [ "$EUID" -eq 0 ]; then + echo -e "${RED}Woah there!${RESET} Seems you're running this script as a superuser." + echo "" + echo "That might cause some issues with permissions and whatnot. Run this script as your default user (without sudo) and I'll ask you when I need superuser permissions" + echo "" + exit 1 +fi + # This one installs utilities to your OS (If you need them!) install_if_needed() { @@ -194,12 +202,12 @@ remember() { say "Keys must consist only of capital letters and underscores" fi - if [[ ! $VALUE =~ ^[A-Za-z0-9/_.:]+$ ]]; then - say "Valid characters for env values: letters, numbers, \".\",\"/\",\"_\"",\":\" + if [[ ! $VALUE =~ ^[A-Za-z0-9/_.:-]+$ ]]; then + say "Valid characters for env values: letters, numbers, \".\",\"/\",\"_\"",\":\", \"-\" fi # If we're setting a valid key/value pair - if [[ ${1} =~ ^[A-Z_]+\=[A-Za-z0-9/._:]*$ ]]; then + if [[ ${1} =~ ^[A-Z_]+\=[A-Za-z0-9/._:-]*$ ]]; then DOTENV_ENTRY=$(cat .env | grep ${KEY}) # If something already exists and we're trying to set it to something new @@ -230,3 +238,5 @@ remember() { } LEAD=1 + +# Confirm? Something to automate the y/n dialog diff --git a/recipes/init.sh b/recipes/init.sh index 101caf4..d233ba8 100755 --- a/recipes/init.sh +++ b/recipes/init.sh @@ -3,48 +3,7 @@ # This is a script to be run on a fresh installation of Raspbian in order to make it suitable (to me) for CLI development # ~ Zen, 2022 -if [ -f "/etc/debian_version" ]; then - DISTRO="debian" - echo "Debian, Ubuntu, or Raspbian OS detected." -elif [ -f "/etc/arch-release" ]; then - DISTRO="arch" - echo "Arch- or Manjaro-based OS detected." -elif [ $(uname | grep -c "Darwin") -eq 1 ]; then - DISTRO="mac" - echo "MacOS detected." -else - echo "I don't know what OS you're running! Cancelling this operation." - exit 1 -fi - -echo "" - -# This makes sure that ctrl+C exits the entire script -trap "exit" INT - -install_if_needed() { - for package in "$@" - do - if [ -z $(which $package) ]; then - echo "installing" $package - - case $DISTRO in - "debian") - sudo apt install -y $package - ;; - "arch") - sudo pacman -S $package --noconfirm - ;; - "mac") - brew install $package - ;; - esac - - else - echo $package 'already installed!' - fi - done -} +source ingredients/lead echo "Updating the repositories..." case $DISTRO in @@ -66,13 +25,13 @@ echo "" echo "Making sure we've got the basics..." case $DISTRO in "debian") - install_if_needed make vim tmux zsh git silversearcher-ag + install_if_needed vim tmux zsh git silversearcher-ag ;; "arch") - install_if_needed make vim tmux zsh git the_silver_searcher + install_if_needed vim tmux zsh git the_silver_searcher ;; "mac") - install_if_needed make vim tmux zsh git the_silver_searcher + install_if_needed vim tmux zsh git the_silver_searcher ;; esac echo "" @@ -90,9 +49,9 @@ cp resources/tmux.conf $HOME/.tmux.conf cp resources/tmux-powerline-theme.sh $HOME/.tmux/tmux-powerline/themes/default.sh echo "" -# TODO is this neededd? can we install p10k on base zsh? -echo "Installing Oh My Zsh for theming - this could take a moment" -sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" +# TODO is this needed? can we install p10k on base zsh? +#echo "Installing Oh My Zsh for theming - this could take a moment" +#sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" cat resources/zshrc-extras >> $HOME/.zshrc echo "" @@ -101,4 +60,4 @@ git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$ sed -i 's/^ZSH_THEME.*/ZSH_THEME="powerlevel10k\/powerlevel10k"/' $HOME/.zshrc echo "" -echo "...and we're back! Now that you've installed everything you need, try closing your connection to the terminal and re-opening." +$SHELL