Skip to content
This repository has been archived by the owner on Feb 9, 2024. It is now read-only.

Commit

Permalink
2.3
Browse files Browse the repository at this point in the history
  • Loading branch information
satouriko committed Feb 8, 2017
1 parent b37df95 commit 02d67cf
Show file tree
Hide file tree
Showing 4 changed files with 139 additions and 35 deletions.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,17 @@ Find [[Wiki]](https://github.com/2645Corp/neu-ipgw_linux/wiki) if you need.

open terminal and run

`$ sudo sh ./install.sh`
`$ sh ./install.sh`

The program will require sudo password.

After running the installer, you may either start from the "Application Menu", or run by command `ipgw`. <br>
Use `ipgw --help` to get more information of usage. <br>

**For version v2.2 and later**
**For version v2.3 and later**

The program will be installed to `/opt/2645/neuipgw/` <br>
You may change the configuration of the installed program by editing `/etc/neuipgw/user.cfg`
You may change the configuration of the installed program by editing `~/.neuipgw/user.cfg`

**For version v2.1 and before**

Expand Down
123 changes: 92 additions & 31 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,47 +7,108 @@
#########################################################################
#!/bin/bash

echo "欢迎使用neu ipgw登陆器 2645工作室出品"
echo "请输入校园网账号:"
echo "Would you like a Chinese installation prompt?(y/N)"
read zh_enable
if [[ $zh_enable == 'y' ]] || [[ $zh_enable == 'Y' ]]; then
echo "欢迎使用NEU IPGW登陆器 2645工作室出品"
else
echo "Thanks for using NEU-IPGW, made by 2645 Studio"
fi

me=`whoami`

if [[ $me == "root" ]];
then
if [[ $zh_enable == 'y' ]] || [[ $zh_enable == 'Y' ]]; then
echo "警告:您正在以超级管理员身份安装,您确定这是您想做的吗?"
else
echo "Warning: You're running as root, are you sure it's what you want to do?"
fi
fi

if [[ $zh_enable == 'y' ]] || [[ $zh_enable == 'Y' ]]; then
echo "您想要为所有用户安装(Y)还是为当前用户安装(n)?"
else
echo "Would you like to install for all users(Y) or for current user only(n)?"
fi
read ins4all

if [[ $zh_enable == 'y' ]] || [[ $zh_enable == 'Y' ]]; then
echo "请输入校园网账号:"
else
echo "Please enter your campus network username:"
fi
read username
echo "请输入校园网密码:"
if [[ $zh_enable == 'y' ]] || [[ $zh_enable == 'Y' ]]; then
echo "请输入校园网密码:"
else
echo "Please enter your password:"
fi
stty -echo
read password
echo "请再次输入校园网密码:"
if [[ $zh_enable == 'y' ]] || [[ $zh_enable == 'Y' ]]; then
echo "请再次输入校园网密码:"
else
echo "Please confirm your password:"
fi
read repassword

while [ $password != $repassword ];
while [[ $password != $repassword ]];
do
echo "两次输入的密码不一致,请重试!"
echo "请输入校园网密码:"
if [[ $zh_enable == 'y' ]] || [[ $zh_enable == 'Y' ]]; then
echo "两次输入的密码不一致,请重试!"
echo "请输入校园网密码:"
else
echo "Password inputted mismatch, please retry!"
echo "Please enter your password:"
fi
read password
echo "请再次输入校园网密码:"
if [[ $zh_enable == 'y' ]] || [[ $zh_enable == 'Y' ]]; then
echo "请再次输入校园网密码:"
else
echo "Please confirm your password:"
fi
read repassword
done
stty echo

mkdir /opt/2645
mkdir /opt/2645/neuipgw
mkdir /etc/neuipgw
cp ./ipgw.sh /opt/2645/neuipgw/ipgw
chmod 755 /opt/2645/neuipgw/ipgw
#cp ./user.cfg /usr/local/neuipgw/user.cfg
echo "#!/bin/bash" > /etc/neuipgw/user.cfg
echo "USER_NAME=$username" >> /etc/neuipgw/user.cfg
echo "USER_PASS=$password" >> /etc/neuipgw/user.cfg
cp ./ipgw.png /opt/2645/neuipgw/ipgw.png
rm -f /usr/bin/ipgw
ln -s /opt/2645/neuipgw/ipgw /usr/bin/ipgw

echo [Desktop Entry]>/usr/share/applications/neuipgw.desktop
echo Name=NEU-IPGW>>/usr/share/applications/neuipgw.desktop
echo Comment=Speedier Internet Access>>/usr/share/applications/neuipgw.desktop
echo Exec=/usr/bin/ipgw>>/usr/share/applications/neuipgw.desktop
echo Icon=/opt/2645/neuipgw/ipgw.png>>/usr/share/applications/neuipgw.desktop
echo Terminal=true>>/usr/share/applications/neuipgw.desktop
echo Type=Application>>/usr/share/applications/neuipgw.desktop
echo Categories=Network>>/usr/share/applications/neuipgw.desktop

echo "安装成功!"
sudo mkdir -p /opt/2645
sudo mkdir -p /opt/2645/neuipgw
mkdir -p /home/$me/.neuipgw
if [[ $ins4all != 'n' ]] && [[ $ins4all != 'N' ]];
then
sudo mkdir -p /usr/share/applications
desktop_path="/usr/share/applications/neuipgw.desktop"
else
mkdir -p /home/$me/.local/share/applications
desktop_path="/home/$me/.local/share/applications/neuipgw.desktop"
fi

sudo cp ./ipgw.sh /opt/2645/neuipgw/ipgw
sudo cp ./install.sh /opt/2645/neuipgw/install.sh
sudo cp ./uninstall.sh /opt/2645/neuipgw/uninstall.sh
sudo chmod 755 /opt/2645/neuipgw/ipgw

echo "#!/bin/bash" > /home/$me/.neuipgw/user.cfg
echo "USER_NAME=$username" >> /home/$me/.neuipgw/user.cfg
echo "USER_PASS=$password" >> /home/$me/.neuipgw/user.cfg
sudo cp ./ipgw.png /opt/2645/neuipgw/ipgw.png
sudo rm -f /usr/bin/ipgw
sudo ln -s /opt/2645/neuipgw/ipgw /usr/bin/ipgw

sudo sh -c "echo [Desktop Entry]>$desktop_path"
sudo sh -c " echo Name=NEU-IPGW>>$desktop_path"
sudo sh -c "echo Comment=Speedier Internet Access>>$desktop_path"
sudo sh -c " echo Exec=/usr/bin/ipgw>>$desktop_path"
sudo sh -c " echo Icon=/opt/2645/neuipgw/ipgw.png>>$desktop_path"
sudo sh -c " echo Terminal=true>>$desktop_path"
sudo sh -c " echo Type=Application>>$desktop_path"
sudo sh -c " echo Categories=Network>>$desktop_path"

if [[ $zh_enable == 'y' ]] || [[ $zh_enable == 'Y' ]]; then
echo "安装成功!"
else
echo "Complete!"
fi


5 changes: 4 additions & 1 deletion ipgw.sh
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,11 @@ DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"

if [ -f "$DIR/user.cfg" ]; then
source $DIR/user.cfg
elif [ -f "/home/`whoami`/.neuipgw/user.cfg" ]; then
source /home/`whoami`/.neuipgw/user.cfg
else
source /etc/neuipgw/user.cfg
echo "No config file found for current user,please specify username! See ipgw --help"
echo -e "You can generate a config file by running the installer with command\n\n sh $DIR/install.sh\n"
fi

temp=$(getopt -q -o qcdfmu:p:h --long connect,disconnect,force,mobile,query,username:,password:,help -- "$@")
Expand Down
38 changes: 38 additions & 0 deletions uninstall.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#########################################################################
# File Name: uninstall.sh
# Author: Li Jiahao
# ###############
# mail: [email protected]
# Created Time: Wed 08 Feb 2017 11:49:25 AM CST
#########################################################################
#!/bin/bash

echo "感谢使用NEU IPGW登陆器 2645工作室出品"

echo "您确定要卸载吗(Y/n)?这将会删除程序安装目录内的所有文件。"
read confirm

if [[ $confirm == 'n' ]] || [[ $confirm == 'N' ]] ;
then
exit
fi

me=`whoami`

sudo rm -rf /opt/2645/neuipgw
sudo rm -rf /usr/local/neuipgw #old version
sudo rm -rf /usr/bin/ipgw
sudo rm -f /usr/share/applications/neuipgw.desktop
rm -f /home/$me/.local/share/applications/neuipgw.desktop
sudo rm -rf /etc/neuipgw #old version

echo "是否清除密码等配置信息(y/N)?此操作将不会影响你电脑上的其他用户。"
read clconfig

if [[ $clconfig == 'y' ]] || [[ $clconfig == 'Y' ]] ;
then
rm -rf /home/$me/.neuipgw
fi


echo "卸载成功!"

0 comments on commit 02d67cf

Please sign in to comment.