Last active
October 1, 2016 03:11
-
-
Save isjerryxiao/ae7399e0078b90dc41fa27e696068a2f to your computer and use it in GitHub Desktop.
rm -rf ssmake.sh && wget --no-cache https://gist.githubusercontent.com/Jerry981028/ae7399e0078b90dc41fa27e696068a2f/raw/ssmake.sh && chmod +x ssmake.sh
This file contains 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 | |
#encoding=utf8 | |
rootpath="/root" | |
openwrtpath=$rootpath"/files/openwrt/OpenWrt-SDK-15.05.1-ar71xx-nand_gcc-4.8-linaro_uClibc-0.9.33.2.Linux-x86_64/" | |
cd $rootpath | |
date | |
function Updatemotd(){ | |
apt update 2>&1 | sed -n '$p' > /etc/motd | |
RESULT=`certbot renew | grep "No renewals were attempted."` | |
if [ "$RESULT" == "No renewals were attempted." ] | |
then | |
echo "所有SSL证书均为最新。" >> /etc/motd | |
else | |
echo "SSL证书有更新!" >> /etc/motd | |
fi | |
RESULT="" | |
echo "上次执行:"`date` >> /etc/motd | |
} | |
function Sysupdate(){ | |
sudo apt update | |
sudo apt upgrade -y | |
#sudo apt install build-essential autoconf libtool libssl-dev gawk debhelper dh-systemd init-system-helpers pkg-config apg libpcre3-dev asciidoc gzip python-pip python-m2crypto | |
} | |
function Compilelibsodium(){ | |
cd $rootpath | |
wget https://download.libsodium.org/libsodium/releases/LATEST.tar.gz | |
tar -xf LATEST.tar.gz | |
cd libsodium* | |
./configure | |
make | |
make install | |
cd .. | |
rm -rf LATEST.tar.gz libsodium* | |
} | |
function Libev(){ | |
cd $rootpath | |
git clone https://github.com/shadowsocks/shadowsocks-libev | |
cd shadowsocks-libev | |
git fetch | |
git reset --hard | |
git pull | |
dpkg-buildpackage -b -i >/dev/null 2>>logcat | |
cd .. | |
dpkg -i shadowsocks-libev_*.deb | |
rm -rf *shadowsocks*.deb *.changes | |
service shadowsocks-libev restart | |
} | |
function Python(){ | |
cd $rootpath | |
git clone https://github.com/breakwa11/shadowsocks.git -b manyuser | |
cd shadowsocks | |
git fetch | |
git reset --hard | |
git pull | |
python setup.py install | |
systemctl restart shadowsocks-server.service | |
} | |
function Openwrt(){ | |
cd $openwrtpath | |
git clone https://github.com/shadowsocks/luci-app-shadowsocks.git package/luci-app-shadowsocks | |
git clone https://github.com/shadowsocks/openwrt-shadowsocks.git package/shadowsocks-libev | |
git clone https://github.com/aa65535/openwrt-chinadns.git package/chinadns | |
git clone https://github.com/aa65535/openwrt-dns-forwarder.git package/dns-forwarder | |
git clone https://github.com/aa65535/openwrt-dist-luci.git package/openwrt-dist-luci | |
cd package/luci-app-shadowsocks | |
git fetch | |
git reset --hard | |
git pull | |
cd ../shadowsocks-libev | |
git fetch | |
git reset --hard | |
git pull | |
cd ../chinadns | |
git fetch | |
git reset --hard | |
git pull | |
cd ../dns-forwarder | |
git fetch | |
git reset --hard | |
git pull | |
cd ../openwrt-dist-luci | |
git fetch | |
git reset --hard | |
git pull | |
cd ../.. | |
make -j2 -k | |
} | |
function Help(){ | |
echo "usage:" | |
echo " -m Updatemotd" | |
echo " -c Libsodium" | |
echo " -l ss-libev" | |
echo " -p ss-python" | |
echo " -o openwrt" | |
echo " -u upgrade" | |
} | |
for arg in "$@" | |
do | |
cd $rootpath | |
case $arg in | |
-m) | |
Updatemotd | |
;; | |
-c) | |
Compilelibsodium | |
;; | |
-l) | |
Libev | |
;; | |
-p) | |
Python | |
;; | |
-o) | |
Openwrt | |
;; | |
-h) | |
Help | |
;; | |
-u) | |
Sysupdate | |
;; | |
*) | |
Help | |
exit 1 | |
;; | |
esac | |
done | |
[[ ! -n "$@" ]]&&Help | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment