Last active
August 29, 2015 14:00
-
-
Save nickvanw/11238938 to your computer and use it in GitHub Desktop.
Dotdeb Install Script
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/bash | |
OFFICIAL_DOTDEB="http://packages.dotdeb.org" | |
APT_FOLDER="/etc/apt/sources.list.d/" | |
DOTDEB_FILE="dotdeb.list" | |
# Make sure we're running this as root! | |
if [[ $UID -ne 0 ]]; then | |
echo "$0 must be run as root" | |
exit 1 | |
fi | |
# Check if we've done this! | |
if [ -f "$APT_FOLDER$DOTDEB_FILE" ]; then | |
echo "DotDeb already installed!" | |
exit 1 | |
fi | |
install_official() { | |
install_key | |
VER=`lsb_release -s -c` | |
touch $APT_FOLDER$DOTDEB_FILE | |
echo "deb $OFFICIAL_DOTDEB $VER all" >> $APT_FOLDER$DOTDEB_FILE | |
echo "deb-src $OFFICIAL_DOTDEB $VER all" >> $APT_FOLDER$DOTDEB_FILE | |
echo "Doing final apt-get update." | |
apt-get update >> /dev/null | |
echo "You are now ready to use Dotdeb on this server." | |
} | |
install_user() { | |
install_key | |
VER=`lsb_release -s -c` | |
echo -n "What is the URL of the dotdeb mirror you want to use?" | |
read line | |
touch $APT_FOLDER$DOTDEB_FILE | |
echo "deb $line $VER all" >> $APT_FOLDER$DOTDEB_FILE | |
echo "deb-src $line $VER all" >> $APT_FOLDER$DOTDEB_FILE | |
echo "Doing final apt-get update." | |
apt-get update >> /dev/null | |
echo "You are now ready to use Dotdeb on this server." | |
} | |
install_key() { | |
echo "Getting Dotdeb gpg key" | |
wget -q http://www.dotdeb.org/dotdeb.gpg | |
apt-key add dotdeb.gpg | |
rm dotdeb.gpg | |
} | |
install_lsb() { | |
echo "Installing lsb-release so we can get your system version" | |
apt-get install lsb-release -y >> /dev/null | |
} | |
install_lsb | |
echo "Would you like to use the official repo?" | |
select yn in "Yes" "No"; do | |
echo $yn | |
case $yn in | |
"Yes" ) install_official; break;; | |
"No" ) install_user; break;; | |
esac | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment