IT'S WORKING
This commit is contained in:
parent
e008025a83
commit
eb137c6b1d
@ -21,7 +21,16 @@ if [ -f /etc/os-release ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# IP Address Retrieval
|
# IP Address Retrieval
|
||||||
|
echo -e "${YELLOW}LOG: Determining primary IPv4 address...${NC}"
|
||||||
|
if command -v hostname >/dev/null 2>&1 && hostname -I >/dev/null 2>&1; then
|
||||||
IP=$(hostname -I | awk '{print $1}')
|
IP=$(hostname -I | awk '{print $1}')
|
||||||
|
elif command -v ip >/dev/null 2>&1; then
|
||||||
|
IP=$(ip route get 1.1.1.1 2>/dev/null | awk '/src/ {print $NF; exit}')
|
||||||
|
elif command -v ifconfig >/dev/null 2>&1; then
|
||||||
|
IP=$(ifconfig | awk '/inet /{print $2}' | grep -v '^127' | head -n1)
|
||||||
|
else
|
||||||
|
IP="127.0.0.1"
|
||||||
|
fi
|
||||||
|
|
||||||
# Install Prerequisites (Git, Make, Zsh, Sudo)
|
# Install Prerequisites (Git, Make, Zsh, Sudo)
|
||||||
echo -e "${YELLOW}LOG: Updating system and installing base tools...${NC}"
|
echo -e "${YELLOW}LOG: Updating system and installing base tools...${NC}"
|
||||||
|
|||||||
17
setup.sh
17
setup.sh
@ -15,11 +15,16 @@ NC='\033[0m'
|
|||||||
# OS Detection
|
# OS Detection
|
||||||
echo -e "${BLUE} LOG:${YELLOW} Checking System...${NC}"
|
echo -e "${BLUE} LOG:${YELLOW} Checking System...${NC}"
|
||||||
|
|
||||||
|
OS="unknown"
|
||||||
if [ -f /etc/os-release ]; then
|
if [ -f /etc/os-release ]; then
|
||||||
. /etc/os-release
|
. /etc/os-release
|
||||||
OS=$ID
|
OS=$ID
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ "$OS" = "unknown" ] || [ -z "$OS" ]; then
|
||||||
|
echo -e "${RED} ERROR:${NC} Could not detect operating system. /etc/os-release not found or ID not set."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
# Package Installation
|
# Package Installation
|
||||||
PACKAGES=(
|
PACKAGES=(
|
||||||
curl wget git sudo
|
curl wget git sudo
|
||||||
@ -76,10 +81,10 @@ fi
|
|||||||
|
|
||||||
if [ "$OS" == "ubuntu" ] || [ "$OS" == "debian" ]; then
|
if [ "$OS" == "ubuntu" ] || [ "$OS" == "debian" ]; then
|
||||||
FINAL_LIST="$FINAL_LIST ca-certificates bsdmainutils pkg-config cmake"
|
FINAL_LIST="$FINAL_LIST ca-certificates bsdmainutils pkg-config cmake"
|
||||||
fi
|
sudo pacman -S --noconfirm --needed "$FINAL_LIST"
|
||||||
|
elif [ "$OS" == "ubuntu" ] || [ "$OS" == "debian" ]; then
|
||||||
echo -e "${BLUE} LOG:${YELLOW} Installing: ${NC}$FINAL_LIST"
|
sudo DEBIAN_FRONTEND=noninteractive apt-get update
|
||||||
|
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y "$FINAL_LIST"
|
||||||
if [ "$OS" == "arch" ] || [ "$OS" == "manjaro" ]; then
|
if [ "$OS" == "arch" ] || [ "$OS" == "manjaro" ]; then
|
||||||
sudo pacman -S --noconfirm --needed $FINAL_LIST
|
sudo pacman -S --noconfirm --needed $FINAL_LIST
|
||||||
elif [ "$OS" == "ubuntu" ] || [ "$OS" == "debian" ]; then
|
elif [ "$OS" == "ubuntu" ] || [ "$OS" == "debian" ]; then
|
||||||
@ -165,13 +170,13 @@ fi
|
|||||||
echo -e "${BLUE} LOG:${YELLOW} Configuring Git Credentials...${NC}"
|
echo -e "${BLUE} LOG:${YELLOW} Configuring Git Credentials...${NC}"
|
||||||
|
|
||||||
if grep -qEi "(Microsoft|WSL)" /proc/version &> /dev/null; then
|
if grep -qEi "(Microsoft|WSL)" /proc/version &> /dev/null; then
|
||||||
GCM_WIN="/mnt/c/Program Files/Git/mingw64/bin/git-credential-manager.exe"
|
# Linux Server: Cache credentials for 12 hours
|
||||||
if [ -f "$GCM_WIN" ]; then
|
if [ -f "$GCM_WIN" ]; then
|
||||||
git config --global credential.helper "! \"$GCM_WIN\""
|
git config --global credential.helper "! \"$GCM_WIN\""
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
# Linux Server: Cache credentials for 12 hour
|
# Linux Server: Cache credentials for 12 hour
|
||||||
git config --global credential.helper 'cache --timeout=43200'
|
git config --global credential.helper 'cache --timeout=43200 --replace-all'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Docker Group
|
# Docker Group
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user