spejsiot-sonoff_pow/init.sh

28 lines
1.1 KiB
Bash
Executable File

#!/bin/bash
BASEDIR=$(dirname ${BASH_SOURCE})
cd "${BASEDIR}"
PROJECT_NAME=${PWD##*/}
tmux attach-session -t "${PROJECT_NAME}" && exit 0
PROJECT_DIR="$PWD"
ENV="$(realpath ./cfg/env)"
tmux new-session -d -P -s "${PROJECT_NAME}" cat || exit 1
tmux set-environment -t "${PROJECT_NAME}" "ENV" "${ENV}"
tmux set-environment -t "${PROJECT_NAME}" "BASH_ENV" "${ENV}"
tmux set-environment -t "${PROJECT_NAME}" "BASH_ENV_INT" "${ENV}"
tmux set-environment -t "${PROJECT_NAME}" "PROJECT_NAME" "${PROJECT_NAME}"
tmux set-environment -t "${PROJECT_NAME}" "PROJECT_DIR" "${PROJECT_DIR}"
tmux new-window -t "${PROJECT_NAME}:1" cat
tmux kill-window -t "${PROJECT_NAME}:0"
tmux new-window -t "${PROJECT_NAME}:0" "bash -i -c \"NVIM_TUI_ENABLE_TRUE_COLOR=1 nvim -S cfg/vim\""
tmux split-window -t "${PROJECT_NAME}:0" -c "${PROJECT_DIR}/soft/"
tmux resize-pane -t "${PROJECT_NAME}:0.0" -Z
tmux kill-window -t "${PROJECT_NAME}:1"
tmux set-option -t "${PROJECT_NAME}" allow-rename off
tmux set-window-option -t "${PROJECT_NAME}" aggressive-resize on
tmux rename-window -t "${PROJECT_NAME}:0" vim
tmux attach-session -t "${PROJECT_NAME}"