Compare commits
16 Commits
53b3a0a955
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 825a159c3e | |||
| 55293daf81 | |||
| 4ef3a5e102 | |||
| bbcacf9c0d | |||
| 3af125681b | |||
| dd41b7f878 | |||
| adf8c33d04 | |||
| 08766b9394 | |||
| c39b6cbc41 | |||
| fd0510e756 | |||
| b934950e67 | |||
| 225a8ea63d | |||
| be4e469a38 | |||
| 9b548d1afe | |||
| 07451953d2 | |||
| 621180b593 |
3
.vscode/settings.json
vendored
Normal file
3
.vscode/settings.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"editor.fontSize": 14
|
||||
}
|
||||
@@ -1,7 +1,13 @@
|
||||
# proxy
|
||||
## Proxmox helper scripts...!!!
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
to use the scripts, type:
|
||||
bash -c "$(curl -fsSL https://raw.githubusercontent.com/galoz11/proxy/refs/heads/main/<Script_Name>.sh)"
|
||||
|
||||
example:
|
||||
bash -c "$(curl -fsSL https://raw.githubusercontent.com/galoz11/proxy/refs/heads/main/code_server.sh)"
|
||||
|
||||
bash -c "$(curl -fsSL https://git.galoz.site/galoz/proxy/raw/branch/main/set_ps1.sh)"
|
||||
|
||||
@@ -1,7 +1,13 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo Installing Coder Code Server
|
||||
function header_info {
|
||||
echo
|
||||
echo -e " ${DGN}${APP}${CL}"
|
||||
echo
|
||||
}
|
||||
|
||||
APP="Coder Code Server"
|
||||
hostname="$(hostname)"
|
||||
IP=$(hostname -I | awk '{print $1}')
|
||||
YW=$(echo "\033[33m")
|
||||
BL=$(echo "\033[36m")
|
||||
@@ -10,17 +16,31 @@ BGN=$(echo "\033[4;92m")
|
||||
GN=$(echo "\033[1;92m")
|
||||
DGN=$(echo "\033[32m")
|
||||
CL=$(echo "\033[m")
|
||||
# print overwrite message
|
||||
BFR="\\r\\033[K"
|
||||
HOLD="-"
|
||||
CM="${GN}✓${CL}"
|
||||
|
||||
APP="Coder Code Server"
|
||||
hostname="$(hostname)"
|
||||
set -o errexit
|
||||
set -o errtrace
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
shopt -s expand_aliases
|
||||
alias die='EXIT=$? LINE=$LINENO error_exit'
|
||||
trap die ERR
|
||||
|
||||
# show header info
|
||||
header_info
|
||||
# Can't Install on Proxmox or Alpine
|
||||
if command -v pveversion >/dev/null 2>&1; then
|
||||
echo -e " Can't Install on Proxmox "
|
||||
exit
|
||||
fi
|
||||
if [ -e /etc/alpine-release ]; then
|
||||
echo -e " Can't Install on Alpine"
|
||||
exit
|
||||
fi
|
||||
while true; do
|
||||
read -p "This will Install ${APP} on $hostname. Proceed(y/n)?" yn
|
||||
case $yn in
|
||||
[Yy]*) break ;;
|
||||
[Nn]*) exit ;;
|
||||
*) echo "Please answer yes or no." ;;
|
||||
esac
|
||||
done
|
||||
# ----------------------installing---------------------------------
|
||||
echo "Installing Dependencies"
|
||||
apt update &>/dev/null
|
||||
apt install -y curl &>/dev/null
|
||||
|
||||
77
docker_portainer.sh
Normal file
77
docker_portainer.sh
Normal file
@@ -0,0 +1,77 @@
|
||||
#!/bin/bash
|
||||
function header_info {
|
||||
echo
|
||||
echo -e " ${DGN}${APP}${CL}"
|
||||
echo
|
||||
}
|
||||
|
||||
|
||||
|
||||
APP="Docker and Portainer"
|
||||
hostname="$(hostname)"
|
||||
IP=$(hostname -I | awk '{print $1}')
|
||||
YW=$(echo "\033[33m")
|
||||
BL=$(echo "\033[36m")
|
||||
RD=$(echo "\033[01;31m")
|
||||
BGN=$(echo "\033[4;92m")
|
||||
GN=$(echo "\033[1;92m")
|
||||
DGN=$(echo "\033[32m")
|
||||
CL=$(echo "\033[m")
|
||||
# print overwrite message
|
||||
BFR="\\r\\033[K"
|
||||
HOLD="-"
|
||||
CM="${GN}✓${CL}"
|
||||
CN="${RD}✗${CL}"
|
||||
|
||||
# show header info
|
||||
header_info
|
||||
# Can't Install on Proxmox or Alpine
|
||||
if command -v pveversion >/dev/null 2>&1; then
|
||||
echo -e " Can't Install on Proxmox "
|
||||
exit
|
||||
fi
|
||||
if [ -e /etc/alpine-release ]; then
|
||||
echo -e " Can't Install on Alpine"
|
||||
exit
|
||||
fi
|
||||
while true; do
|
||||
read -p "This will Install ${APP} on $hostname. Proceed(y/n)?" yn
|
||||
case $yn in
|
||||
[Yy]*) break ;;
|
||||
[Nn]*) kill -INT $$ ;;
|
||||
*) echo "Please answer yes or no." ;;
|
||||
esac
|
||||
done
|
||||
# ----------------------installing---------------------------------
|
||||
echo "Installing updates"
|
||||
apt update &>/dev/null
|
||||
echo "Installed updates"
|
||||
|
||||
if command -v docker &> /dev/null; then
|
||||
echo -e "${CM} Docker is installed"
|
||||
else
|
||||
echo -e "${CN} Docker is not installed"
|
||||
apt-get install docker.io -y &>/dev/null
|
||||
echo -e "${CM} Docker is installed"
|
||||
fi
|
||||
|
||||
|
||||
CONTAINER=portainer
|
||||
if [ "$(docker ps -a -q -f name=^/${CONTAINER}$)" ]; then
|
||||
echo -e "${CM} $CONTAINER exists"
|
||||
else
|
||||
echo -e "${CN} '$CONTAINER' does not exist, creating it now"
|
||||
docker volume create portainer_data &>/dev/null
|
||||
docker run -d \
|
||||
-p 8000:8000 \
|
||||
-p 9443:9443 \
|
||||
--name portainer \
|
||||
--restart=always \
|
||||
-v /var/run/docker.sock:/var/run/docker.sock \
|
||||
-v portainer_data:/data \
|
||||
portainer/portainer-ce:latest &>/dev/null
|
||||
echo -e "${BFR}${BFR}${CM} $CONTAINER installed"
|
||||
echo -e "Portainer should be reachable by going to the following URL.
|
||||
${BL}https://$IP:9443${CL} \n"
|
||||
|
||||
fi
|
||||
@@ -1,11 +1,46 @@
|
||||
#!/bin/bash
|
||||
|
||||
function header_info {
|
||||
echo
|
||||
echo -e " ${DGN}${APP}${CL}"
|
||||
echo
|
||||
}
|
||||
|
||||
APP="Coder Code Server"
|
||||
hostname="$(hostname)"
|
||||
IP=$(hostname -I | awk '{print $1}')
|
||||
YW=$(echo "\033[33m")
|
||||
BL=$(echo "\033[36m")
|
||||
RD=$(echo "\033[01;31m")
|
||||
BGN=$(echo "\033[4;92m")
|
||||
GN=$(echo "\033[1;92m")
|
||||
DGN=$(echo "\033[32m")
|
||||
CL=$(echo "\033[m")
|
||||
# print overwrite message
|
||||
BFR="\\r\\033[K"
|
||||
HOLD="-"
|
||||
CM="${GN}✓${CL}"
|
||||
|
||||
# show header info
|
||||
header_info
|
||||
# Can't Install on Proxmox or Alpine
|
||||
if command -v pveversion >/dev/null 2>&1; then
|
||||
echo -e "⚠️ Can't Install on Proxmox "
|
||||
echo -e " Can't Install on Proxmox "
|
||||
exit
|
||||
fi
|
||||
if [ -e /etc/alpine-release ]; then
|
||||
echo -e " Can't Install on Alpine"
|
||||
exit
|
||||
fi
|
||||
while true; do
|
||||
read -p "This will Install ${APP} on $hostname. Proceed(y/n)?" yn
|
||||
case $yn in
|
||||
[Yy]*) break ;;
|
||||
[Nn]*) exit ;;
|
||||
*) echo "Please answer yes or no." ;;
|
||||
esac
|
||||
done
|
||||
|
||||
header_info
|
||||
echo -e "${BL}Ready yo install ${APP} on $hostname${CL}"
|
||||
echo bye
|
||||
|
||||
|
||||
23
pct_public_key.sh
Normal file
23
pct_public_key.sh
Normal file
@@ -0,0 +1,23 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Define the public key to add
|
||||
PUBLIC_KEY="ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCb2LEZS8zM3Pd2irwMOmrMhUB6ZMcIwyC0aWJIqTVIQVxEm3FIgN8ugJDqyv9vE6efwrAmbTxwi/bcXqKbo+ci2CRBrryvSzZDBsBMQYbDc3zervduLt9MQSjOHKxHlBH73G7qs0cyXBroO+Rpe+5t0WtJkR5MPNQf7+s07Y83viBF31oh5a3rGYvbxaLd0hOW622o/2/thVQS9Q1FlMtILA9Hn5PAWp/LZcTzFnqeVbstznzBvSmjfvvLxF9Ujeldm2cPUD8OXKjfMX4K5gGaGp+p8vI5rijUTdX1Yj7iKAM+NGXpjh90o4PCRfOSW5mP2mf31jhsFRJRxiKxPZAJ rsa-key-20250707" # <--- REPLACE THIS WITH YOUR ACTUAL PUBLIC KEY
|
||||
|
||||
# Define file paths
|
||||
SSH_DIR="$HOME/.ssh"
|
||||
AUTHORIZED_KEYS_FILE="$SSH_DIR/authorized_keys"
|
||||
|
||||
# Create .ssh directory and set permissions if it doesn't exist
|
||||
mkdir -p "$SSH_DIR" && chmod 700 "$SSH_DIR" || { echo "Error: Could not create or set permissions for $SSH_DIR. Exiting."; exit 1; }
|
||||
|
||||
# Create authorized_keys file and set permissions if it doesn't exist
|
||||
touch "$AUTHORIZED_KEYS_FILE" && chmod 600 "$AUTHORIZED_KEYS_FILE" || { echo "Error: Could not create or set permissions for $AUTHORIZED_KEYS_FILE. Exiting."; exit 1; }
|
||||
|
||||
# Check if the key already exists to prevent duplicates
|
||||
if grep -qF "$PUBLIC_KEY" "$AUTHORIZED_KEYS_FILE"; then
|
||||
echo "Key already exists in $AUTHORIZED_KEYS_FILE. No changes made."
|
||||
else
|
||||
# Add the key
|
||||
echo "$PUBLIC_KEY" >> "$AUTHORIZED_KEYS_FILE"
|
||||
echo "Key successfully added to $AUTHORIZED_KEYS_FILE."
|
||||
fi
|
||||
24
set_ps1.sh
Normal file
24
set_ps1.sh
Normal file
@@ -0,0 +1,24 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Define the new PS1 string
|
||||
# Example: [User@Host CurrentDir]$
|
||||
# This example uses colors: green for user@host, blue for directory.
|
||||
# \u: username
|
||||
# \h: hostname (short)
|
||||
# \w: current working directory (basename only)
|
||||
# \$: # if root, $ otherwise
|
||||
NEW_PS1='\[\e[1m\]\[\e[90m\]0\[\e[0;32m\]\u@\[\e[36m\]\h\[\e[90m\]:\[\e[33m\]\w\[\e[90m\]$ \[\e[m\]'
|
||||
|
||||
# The line to be added to .bashrc
|
||||
PS1_LINE="PS1='${NEW_PS1}'"
|
||||
|
||||
# Check if the line already exists in .bashrc to prevent duplicates
|
||||
if grep -qE "^PS1=" ~/.bashrc; then
|
||||
echo "PS1 setting already exists in ~/.bashrc. No changes made."
|
||||
else
|
||||
# Append the PS1 line to .bashrc
|
||||
echo -e "\n" >> ~/.bashrc # Ensure there's a newline before adding
|
||||
echo "${PS1_LINE}" >> ~/.bashrc
|
||||
echo "PS1 setting has been added to ~/.bashrc."
|
||||
echo "Please open a new terminal or run 'source ~/.bashrc' for changes to take effect."
|
||||
fi
|
||||
Reference in New Issue
Block a user