diff --git a/env/.local/scripts/hpa b/env/.local/scripts/hpa index ebe84ad..b6d6cc7 100755 --- a/env/.local/scripts/hpa +++ b/env/.local/scripts/hpa @@ -22,15 +22,20 @@ SCRIPTS=${SCRIPTS:-$HOME/.local/scripts} ############################## MAIN ############################## -last_pull="0" -if [[ -f "$HPA_CONFIG_DIR/.lastpull" ]]; then - last_pull=$(cat "$HPA_CONFIG_DIR/.lastpull") -fi -curr=$(date +%s) -diff=$((curr - last_pull)) +# Don't pull images if they're prefixed with 'localhost'. +if echo "$HPA_DOCKER_IMAGE" | grep -vq "localhost"; then -if [[ $HPA_AUTO_PULL == "1" ]] && [[ $diff -gt "$HPA_AUTO_PULL_INTERVAL" ]]; then - . "$SCRIPTS/hpa-pull" "$HPA_AUTO_PULL_OPTS" + # Check if we should pull the image prior to running. + last_pull="0" + if [[ -f "$HPA_CONFIG_DIR/.lastpull" ]]; then + last_pull=$(cat "$HPA_CONFIG_DIR/.lastpull") + fi + curr=$(date +%s) + diff=$((curr - last_pull)) + + if [[ $HPA_AUTO_PULL == "1" ]] && [[ $diff -gt "$HPA_AUTO_PULL_INTERVAL" ]]; then + . "$SCRIPTS/hpa-pull" "$HPA_AUTO_PULL_OPTS" + fi fi podman run --rm --interactive --tty \ diff --git a/env/.local/scripts/utils/hpa/hpa.env b/env/.local/scripts/utils/hpa/hpa.env index 1be9550..91c28e8 100755 --- a/env/.local/scripts/utils/hpa/hpa.env +++ b/env/.local/scripts/utils/hpa/hpa.env @@ -12,7 +12,7 @@ XDG_CONFIG_HOME=${XDG_CONFIG_HOME:-$HOME/.config} XDG_DATA_HOME=${XDG_DATA_HOME:-$HOME/.local/share} # Docker vars. -HPA_DOCKER_IMAGE="git.housh.dev/michael/swift-hpa" +HPA_DOCKER_IMAGE=${HPA_DOCKER_IMAGE:-"git.housh.dev/michael/swift-hpa"} HPA_DOCKER_TAG=${HPA_DOCKER_TAG:-"latest"} # Auto pull options to be ran before running the hpa docker diff --git a/runs/after/system b/runs/after/system index 3f12a74..1bcf56b 100755 --- a/runs/after/system +++ b/runs/after/system @@ -18,6 +18,15 @@ _setup-mounts() { sudo mount -a || log --warning "You will need to make sure this computer's ip is in the allow list, then run 'sudo mount -a'" fi + line="nas.housh.dev:/var/nfs/shared/Customer_Share /mnt/customers nfs defaults 0 0" + if sudo cat /etc/fstab | grep -vq "$line"; then + log " Setting up nas mount." + sudo mkdir -p /mnt/customers &>/dev/null + echo "$line" | sudo tee --append /etc/fstab + sudo systemctl daemon-reload + sudo mount -a || + log --warning "You will need to make sure this computer's ip is in the allow list, then run 'sudo mount -a'" + fi } _setup-kanata() {