rendered paste body#!/bin/bash# 一次加入多個ppa來源,加入後自動更新套件庫# 檢查是否有符合目前版本ppa來源# 避免重複加入ppa來源# 名稱:ppa-acd (add check double)# 作者: hepha http://playubuntu.blogspot.com/# 授權: LGPL v2CODE=`lsb_release -cs`for ADD in "$@"do TEST=$(echo $ADD|sed 's@ppa:@ppa.launchpad.net/@') echo $ADD |sed 's@:@~@ ;s@/@/+archive/@ ; s@^ppa@http://launchpad.net/@' | while read DOWNLOAD do wget -q -O - $DOWNLOAD |grep value=\"$CODE >/dev/null 2>&1 if [ $? -eq 0 ] then if test -z "$(grep $TEST /etc/apt/{*.list,sources.list.d/*.list}|grep -v '^#')" then (sudo apt-add-repository $ADD >/dev/null 2>&1 && echo "Now add $ADD") else echo "Already have "$ADD"" fi else echo "This "$ADD" not have: $CODE" fi donedonesudo aptitude update