Last active
March 22, 2018 03:38
-
-
Save laurelmay/1069416bc1955a48e020fad155a16dc3 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/usr/bin/env bash | |
# Get the info about the current distro | |
source /etc/os-release | |
if [ -z $UBUNTU_CODENAME ]; then | |
echo "Not on Ubuntu." | |
exit 1 | |
fi | |
distro="$ID" | |
mirror_url="https://mirror.cs.jmu.edu/pub" | |
# For the Ubuntu stuff, UBUNTU_CODENAME has to be used because it is consistent | |
# between Mint and Ubuntu, whereas VERSION_CODENAME on Ubuntu is the same as | |
# UBUNTU_CODENAME but on Mint it is the codename of the current Mint version. | |
# I think the /linuxmint/packages may not necessarily be the same for all | |
# mirrors, but so long as JMU CS is the primary concern, that should be alright | |
# Print the Ubuntu stuff to /etc/apt/sources.list when doing for real; this | |
# goes to stdout as an example | |
echo "# DO NOT EDIT THIS FILE. AUTOMATICALLY GENERATED | |
deb ${mirror_url}/ubuntu $UBUNTU_CODENAME main restricted universe multiverse | |
deb ${mirror_url}/ubuntu ${UBUNTU_CODENAME}-updates main restricted universe multiverse | |
deb ${mirror_url}/ubuntu ${UBUNTU_CODENAME}-backports main restricted universe multiverse | |
deb ${mirror_url}/ubuntu ${UBUNTU_CODENAME}-security main restricted universe multiverse | |
deb http://archive.canonical.com/ubuntu/ ${UBUNTU_CODENAME} partner" | |
if [ "$distro" == "ubuntu" ]; then | |
exit 0; | |
fi | |
# Prnt the Mint stuff to /etc/apt/sources.list.d/official-package-repositories.list | |
# when doing this for real; this goes to stdout for the example | |
echo "DO NOT EDIT THIS FILE. AUTOMATICALLY GENERATED | |
deb ${mirror_url}/linuxmint/packages ${VERSION_CODENAME} main upstream import backport" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment