Adding a repository into /etc/apt/sources.list.d without python-software-properties installed

Here is an easy solution to install a new repository into /etc/apt/sources.list.d (e.g. ubuntu) without using the python-software-properties package. I found this in the relateiq/oracle-java8 Dockerfile . This example installs the Oracle JDK via the webupd8 java ppa.

echo "deb precise main" | tee -a /etc/apt/sources.list
echo "deb-src precise main" | tee -a /etc/apt/sources.list
apt-key adv --keyserver --recv-keys EEA14886

and then the installation:

apt-get update
# auto accept oracle jdk license
echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | /usr/bin/debconf-set-selections
apt-get install -y oracle-java8-installer