Added pm-task upgrade.
This commit is contained in:
86
after-setup
Executable file
86
after-setup
Executable file
@@ -0,0 +1,86 @@
|
||||
#!/bin/bash
|
||||
|
||||
# 1. Function to set up dir colors.
|
||||
run_colourful_console() {
|
||||
# Download the 256 colors dark theme.
|
||||
curl -fsSL https://raw.githubusercontent.com/seebi/dircolors-solarized/master/dircolors.256dark -o $HOME/.dircolors
|
||||
|
||||
# Create directory for vim colors if it doesn't exist.
|
||||
mkdir -p $HOME/.vim/colors
|
||||
|
||||
# Download jellybeans theme for vim.
|
||||
curl -fsSL https://raw.githubusercontent.com/nanotech/jellybeans.vim/master/colors/jellybeans.vim -o $HOME/.vim/colors/jellybeans.vim
|
||||
|
||||
# Add or update .vimrc to set the colorscheme to jellybeans.
|
||||
if [ ! -f "$HOME/.vimrc" ]; then
|
||||
cat <<EOF > $HOME/.vimrc
|
||||
syntax on
|
||||
set tabstop=4
|
||||
set softtabstop=4
|
||||
set shiftwidth=4
|
||||
set expandtab
|
||||
set background=dark
|
||||
colorscheme jellybeans
|
||||
EOF
|
||||
echo "Created .vimrc with jellybeans colorscheme."
|
||||
else
|
||||
sed -i '/^colorscheme/d' $HOME/.vimrc
|
||||
echo "colorscheme jellybeans" >> $HOME/.vimrc
|
||||
echo "Updated .vimrc with jellybeans colorscheme."
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
# 2. Function to generate commands to update SSHD config.
|
||||
run_generate_sshd_commands() {
|
||||
echo 'sudo sed -i "/#TCPKeepAlive yes/c\TCPKeepAlive no" /etc/ssh/sshd_config'
|
||||
echo 'sudo sed -i "/^ClientAliveInterval/c\ClientAliveInterval 30" /etc/ssh/sshd_config'
|
||||
echo 'sudo sed -i "/^ClientAliveCountMax/c\ClientAliveCountMax 300" /etc/ssh/sshd_config'
|
||||
echo 'sudo systemctl restart sshd'
|
||||
}
|
||||
|
||||
# 3. Function to set up tmux with tpm and a custom configuration.
|
||||
run_setup_tmux() {
|
||||
|
||||
if ! command -v git &> /dev/null || ! command -v tmux &> /dev/null; then
|
||||
echo "Please install git and tmux before running this task."
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Clone tpm if it's not already cloned
|
||||
TPM_DIR="$HOME/.tmux/plugins/tpm"
|
||||
if [ ! -d "$TPM_DIR" ]; then
|
||||
git clone https://github.com/tmux-plugins/tpm.git $TPM_DIR
|
||||
echo "Cloned tpm into $TPM_DIR"
|
||||
fi
|
||||
|
||||
# Get the absolute path to the directory containing this bash script
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
|
||||
# Copy _tmux.conf to .tmux.conf in the user's home directory
|
||||
cp "$SCRIPT_DIR/templates/_tmux.conf" $HOME/.tmux.conf
|
||||
echo "Copied $SCRIPT_DIR/templates/_tmux.conf to $HOME/.tmux.conf"
|
||||
echo "Now start tmux and press prefix + I to install the plugins."
|
||||
}
|
||||
|
||||
# Tasks menu
|
||||
echo "Select a task:"
|
||||
echo "1. Colourful Console"
|
||||
echo "2. Generate Commands to update SSHD config"
|
||||
echo "3. Setup tmux"
|
||||
read choice
|
||||
|
||||
case $choice in
|
||||
1)
|
||||
run_colourful_console
|
||||
;;
|
||||
2)
|
||||
run_generate_sshd_commands
|
||||
;;
|
||||
3)
|
||||
run_setup_tmux
|
||||
;;
|
||||
*)
|
||||
echo "Invalid choice."
|
||||
;;
|
||||
esac
|
||||
Reference in New Issue
Block a user