-
-
Save sysroad/4878224670b5b4312d8308cab73f78bb to your computer and use it in GitHub Desktop.
우분투(ubuntu)의 apt 기본 미러(mirror)를 다음 카카오(kakao), 네오위즈(neowiz), harukasan 으로 변경
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
#!/bin/sh | |
SL=/etc/apt/sources.list | |
PARAM="r:hm:dna" | |
KAKAO=mirror.kakao.com | |
NEOWIZ=ftp.neowiz.com | |
HARU=ftp.harukasan.org | |
function usage { | |
echo "USAGE: $0 [OPTION] "; | |
echo -e "\r\n-b : make backup file"; | |
echo "-r[sources.list] : specify source list file (default ${SL})" | |
echo "-m[mirror-url] : speficy mirror site url" | |
echo "-k : use kakao mirror (${KAKAO})" | |
echo "-n : use neowiz mirror (${NEOWIZ})" | |
echo "-a : use harukasan mirror (${HARU})" | |
exit 0; | |
} | |
REPOS=${KAKAO} | |
while getopts $PARAM opt; do | |
case $opt in | |
r) | |
echo "-r option was supplied. OPTARG: $OPTARG" >&2 | |
SL=$OPTARG; | |
;; | |
m) | |
echo "Using mirror repository(${OPTARG})." >&2 | |
REPOS=${OPTARG} | |
;; | |
k) | |
echo "Using Kakao repository(${KAKAO})." >&2 | |
REPOS=${KAKAO} | |
;; | |
n) | |
echo "Using neowiz repository(${NEOWIZ})." >&2 | |
REPOS=${NEOWIZ} | |
;; | |
a) | |
echo "Using harukasan repository(${HARU})." >&2 | |
REPOS=${HARU} | |
;; | |
h) | |
usage; | |
;; | |
esac | |
done | |
echo "using repository(${REPOS})" | |
## change mirror | |
sed -i.bak -re "s/([a-z]{2}.)?archive.ubuntu.com|security.ubuntu.com/${REPOS}/g" ${SL} | |
## check | |
apt update |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment