29 lines
1.0 KiB
Bash
29 lines
1.0 KiB
Bash
#!/usr/bin/env bash
|
|
|
|
RELEASE=stable
|
|
URL="dl.yarnpkg.com"
|
|
|
|
#curl -sS https://${URL}/debian/pubkey.gpg | sudo apt-key add -
|
|
curl -sS https://${URL}/debian/pubkey.gpg | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/yarn.gpg
|
|
|
|
echo "deb https://${URL}/debian/ ${RELEASE} main" | sudo tee /etc/apt/sources.list-available/yarn.list
|
|
ln -sf /etc/apt/sources.list-available/yarn.list /etc/apt/sources.list.d/yarn.list
|
|
|
|
# Bypass apt-proxy for yarn packages
|
|
# if 02proxy exists check to see if the url is already in it, if so do nothing , if it isn't add it,
|
|
# if 02proxy doesn't exist create it. successful grep 0, unsuccessful 1
|
|
if [ -f /etc/apt/apt.conf.d/02proxy ]; then
|
|
echo "02proxy contains: "
|
|
cat /etc/apt/apt.conf.d/02proxy
|
|
if [ ! -z $(grep ${URL} /etc/apt/apt.conf.d/02proxy) ]; then
|
|
echo "first"
|
|
echo "Acquire::http::Proxy { \"${URL}\" DIRECT; };" >> /etc/apt/apt.conf.d/02proxy
|
|
fi
|
|
else
|
|
echo "second"
|
|
echo "Acquire::http::Proxy { \"${URL}\" DIRECT; };" >> /etc/apt/apt.conf.d/02proxy
|
|
fi
|
|
|
|
sudo apt update && sudo apt install -y --no-install-recommends yarn
|
|
|