Skip to content

Instantly share code, notes, and snippets.

@lifeofcoding
Last active May 20, 2020 19:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lifeofcoding/aa1fa0f9063b2ee39a0c01965fca40da to your computer and use it in GitHub Desktop.
Save lifeofcoding/aa1fa0f9063b2ee39a0c01965fca40da to your computer and use it in GitHub Desktop.
Script to add any third party repo to ANY machine (aka adding ubuntu repo to kali)
sudo apt-get install python3-software-properties
sudo apt-get install apt-file
sudo apt-file update
gksudo gedit /usr/sbin/add-apt-repository
-----------------------------------------------------------------------------------------------------------------
#!/bin/bash
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"
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
#(HERE tried changing the distro name to EVERYTHING I could think of)
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"
echo "$0 ppa:user/ppa-name"
fi
----------------------------------------------------------------------------------------------------------------------------
cd /usr/sbin
sudo ./add-apt-repository ppa:user/ppa-name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment