Created
August 19, 2020 22:50
-
-
Save d3417/0c8e4ae7d0e0ba5932afb6b1bf274188 to your computer and use it in GitHub Desktop.
Force add-apt-repository to add all Repos in Linux with this fantastic SH Script ;) You can add it in .bashrc or /usr/sbin
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 | |
""" | |
Put it in /usr/sbin/ or $HOME/.bashrc exactly was named in gist and run after chmod o+x add-apt-repository && chown root:root add-apt-repository | |
in this way> | |
sudo ./add-apt-repository ppa:unsupported/repolol | |
Ripped by Denis Sossich, but really it's not my code. ^_^ | |
""" | |
if [ $# -eq 1 ] | |
NM=`uname -a && date` | |
NAME=`echo $NM | md5sum | cut -f1 -d" "` | |
then | |
ppa_name=`echo "$1" | cut -d":" -f2 -s` | |
if [ -z "$ppa_name" ] | |
then | |
echo "PPA name not found" | |
echo "Utility to add PPA repositories in your debian machine, ripped by Denis Sossich" | |
echo "$0 ppa:user/ppa-name" | |
else | |
echo "$ppa_name" | |
echo "deb http://ppa.launchpad.net/$ppa_name/ubuntu oneiric main" >> /etc/apt/sources.list | |
apt-get update >> /dev/null 2> /tmp/${NAME}_apt_add_key.txt | |
key=`cat /tmp/${NAME}_apt_add_key.txt | cut -d":" -f6 | cut -d" " -f3` | |
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys $key | |
rm -rf /tmp/${NAME}_apt_add_key.txt | |
fi | |
else | |
echo "Utility to add PPA repositories in your debian machine, ripped by Denis Sossich" | |
echo "$0 ppa:user/ppa-name" | |
fi | |
#Added by Denis Sossich | |
RESULT=$? | |
if [ $RESULT -eq 0 ]; then | |
Command Success | |
else | |
Command Failed | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment