|
|
@ -12,6 +12,33 @@ if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then |
|
|
|
exit 1 |
|
|
|
fi |
|
|
|
|
|
|
|
echo "Detect Base Image ..." |
|
|
|
baseImage="?" |
|
|
|
isDietPi=$(uname -n | grep -c 'DietPi') |
|
|
|
isRaspbian=$(cat /etc/os-release 2>/dev/null | grep -c 'Raspbian') |
|
|
|
isArmbian=$(cat /etc/os-release 2>/dev/null | grep -c 'Debian') |
|
|
|
isUbuntu=$(cat /etc/os-release 2>/dev/null | grep -c 'Ubuntu') |
|
|
|
if [ ${isRaspbian} -gt 0 ]; then |
|
|
|
baseImage="raspbian" |
|
|
|
fi |
|
|
|
if [ ${isArmbian} -gt 0 ]; then |
|
|
|
baseImage="armbian" |
|
|
|
fi |
|
|
|
if [ ${isUbuntu} -gt 0 ]; then |
|
|
|
baseImage="ubuntu" |
|
|
|
fi |
|
|
|
if [ ${isDietPi} -gt 0 ]; then |
|
|
|
baseImage="dietpi" |
|
|
|
fi |
|
|
|
if [ "${baseImage}" = "?" ]; then |
|
|
|
cat /etc/os-release 2>/dev/null |
|
|
|
echo "!!! FAIL !!!" |
|
|
|
echo "Base Image cannot be detected or is not supported." |
|
|
|
exit 1 |
|
|
|
else |
|
|
|
echo "OK running ${baseImage}" |
|
|
|
fi |
|
|
|
|
|
|
|
# function: install keys & sources |
|
|
|
prepareTorSources() |
|
|
|
{ |
|
|
@ -29,8 +56,13 @@ prepareTorSources() |
|
|
|
echo "" |
|
|
|
|
|
|
|
echo "*** Adding Tor Sources to sources.list ***" |
|
|
|
if [ "${baseImage}" = "raspbian" ] || [ "${baseImage}" = "armbian" ] || [ "${baseImage}" = "dietpi" ]; then |
|
|
|
echo "deb https://deb.torproject.org/torproject.org stretch main" | sudo tee -a /etc/apt/sources.list |
|
|
|
echo "deb-src https://deb.torproject.org/torproject.org stretch main" | sudo tee -a /etc/apt/sources.list |
|
|
|
elif [ "${baseImage}" = "ubuntu" ]; then |
|
|
|
echo "deb https://deb.torproject.org/torproject.org bionic main" | sudo tee -a /etc/apt/sources.list |
|
|
|
echo "deb-src https://deb.torproject.org/torproject.org bionic main" | sudo tee -a /etc/apt/sources.list |
|
|
|
fi |
|
|
|
echo "OK" |
|
|
|
echo "" |
|
|
|
} |
|
|
|