Created
August 23, 2013 05:58
-
-
Save perfectfoolish/6315963 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
#!/bin/bash | |
if [ `uname -m` = "x86_64" ]; then | |
ARCH="linux64" | |
else | |
ARCH="linux32" | |
fi | |
#AEGIS_UPDATE_SITE="http://update.aegis.aliyun.com" | |
AEGIS_UPDATE_SITE="http://aegis.oss.aliyuncs.com" | |
AEGIS_INSTALL_DIR="/usr/local/aegis" | |
install_aegis() { | |
killall -9 aegis_update | |
killall -9 aegis_cli | |
if [ -d ${AEGIS_INSTALL_DIR} ];then | |
rm -rf ${AEGIS_INSTALL_DIR} | |
fi | |
mkdir -p "${AEGIS_INSTALL_DIR}/aegis_client" | |
mkdir -p "${AEGIS_INSTALL_DIR}/aegis_update" | |
wget "${AEGIS_UPDATE_SITE}/$ARCH/aegis_update" -O "${AEGIS_INSTALL_DIR}/aegis_update/aegis_update" | |
if [ $? != 0 ]; then | |
echo "wget aegis_update error" 1>&2 | |
exit 1 | |
fi | |
wget "${AEGIS_UPDATE_SITE}/$ARCH/agx_update.cfg" -O "${AEGIS_INSTALL_DIR}/aegis_update/agx_update.cfg" | |
if [ $? != 0 ]; then | |
echo "wget agx_update.cfg error" 1>&2 | |
exit 1 | |
fi | |
chmod +x "${AEGIS_INSTALL_DIR}/aegis_update/aegis_update" | |
} | |
install_service(){ | |
wget "${AEGIS_UPDATE_SITE}/aegis" -O /etc/init.d/aegis | |
if [ $? != 0 ]; then | |
echo "wget aegis error" 1>&2 | |
exit 1 | |
fi | |
chmod +x /etc/init.d/aegis | |
rm -f /etc/rc2.d/S80aegis | |
rm -f /etc/rc3.d/S80aegis | |
rm -f /etc/rc4.d/S80aegis | |
rm -f /etc/rc5.d/S80aegis | |
ln -s /etc/init.d/aegis /etc/rc2.d/S80aegis >/dev/null 2>&1 | |
ln -s /etc/init.d/aegis /etc/rc3.d/S80aegis >/dev/null 2>&1 | |
ln -s /etc/init.d/aegis /etc/rc4.d/S80aegis >/dev/null 2>&1 | |
ln -s /etc/init.d/aegis /etc/rc5.d/S80aegis >/dev/null 2>&1 | |
} | |
uninstall_service() { | |
rm -f /etc/init.d/aegis | |
rm -f /etc/rc2.d/S80aegis | |
rm -f /etc/rc3.d/S80aegis | |
rm -f /etc/rc4.d/S80aegis | |
rm -f /etc/rc5.d/S80aegis | |
} | |
if [ `id -u` -ne "0" ]; then | |
echo "ERROR: This script must be run as root." 1>&2 | |
exit 1 | |
fi | |
install_aegis | |
install_service | |
service aegis start | |
echo "Aegis install successful" | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment