Last active
April 2, 2024 19:37
-
-
Save Traineratwot/e2a8b168ee05426ab63cb871213fd746 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
PROXY="http://192.168.10.131:3142" | |
DISTRO=$(awk -F= '/^NAME/{print $2}' /etc/os-release | tr -d '"') | |
echo "Setup apt Proxy: $PROXY" | |
case $DISTRO in | |
*"Debian"*) | |
# Actions for Ubuntu | |
echo "Acquire::https::Proxy DIRECT;Acquire::http::Proxy \"$PROXY\";" > /etc/apt/apt.conf.d/proxy | |
echo "Success: /etc/apt/apt.conf.d/proxy" | |
cat /etc/apt/apt.conf.d/proxy | |
;; | |
*"Ubuntu"*) | |
# Actions for Ubuntu | |
echo "Acquire::https::Proxy DIRECT;Acquire::http::Proxy \"$PROXY\";" > /etc/apt/apt.conf.d/proxy | |
echo "Success: /etc/apt/apt.conf.d/proxy" | |
cat /etc/apt/apt.conf.d/proxy | |
;; | |
*"Alpine"*) | |
# Actions for Alpine | |
echo "http_proxy=\"$PROXY\"" > /etc/abuild.conf | |
echo "Success: /etc/abuild.conf" | |
cat /etc/abuild.conf | |
;; | |
*"Arch"*) | |
# Actions for Arch | |
echo "Actions for Arch" | |
;; | |
*) | |
echo "Unsupported distribution: $DISTRO" | |
;; | |
esac | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment