Skip to content

创建别名 unblock163 #52

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 24 additions & 2 deletions unblock163.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ export PATH
# --------------------------------------------------------------
# 系统: CentOS/Debian/Ubuntu
# 项目: 解锁网易云音乐
# 版本: 1.1.5
# 版本: 1.1.6
# 作者: XIU2
# 官网: https://shell.xiu2.xyz
# 项目: https://github.com/XIU2/Shell
# --------------------------------------------------------------

NOW_VER_SHELL="1.1.5"
NOW_VER_SHELL="1.1.6"
NEW_VER_NODE_BACKUP="16.9.1"
FILEPASH=$(cd "$(dirname "$0")"; pwd)
FILEPASH_NOW=$(echo -e "${FILEPASH}"|awk -F "$0" '{print $1}')
Expand Down Expand Up @@ -169,6 +169,26 @@ _SERVICE(){
fi
echo -e "${INFO} ${NAME} 服务管理脚本下载完成 !"
}
# 添加别名
_ALIAS_SET(){
if [ -f "/etc/bashrc" ];then
echo alias unblock163="'/etc/init.d/${NAME_SERVICE}'">> /etc/bashrc
source /etc/bashrc
elif [ -f "/etc/bash.bashrc" ];then
echo alias unblock163="'/etc/init.d/${NAME_SERVICE}'">> /etc/bash.bashrc
source /etc/bash.bashrc
fi
}
# 删除别名
_ALIAS_UNSET(){
if [ -f "/etc/bashrc" ];then
sed -i '/unblock163/d' /etc/bashrc
source /etc/bashrc
elif [ -f "/etc/bash.bashrc" ];then
sed -i '/unblock163/d' /etc/bash.bashrc
source /etc/bash.bashrc
fi
}
# 安装失败善后处理
_INSTALLATION_FAILURE_CLEANUP() {
[[ -e "${FOLDER}" ]] && rm -rf "${FOLDER}"
Expand Down Expand Up @@ -363,6 +383,7 @@ _INSTALL() {
_DOWNLOAD
echo -e "${INFO} 开始下载/安装 服务脚本(init)..."
_SERVICE
_ALIAS_SET
echo -e "${INFO} 开始写入 配置文件..."
_CONFIG_OPERATION "WRITE"
echo -e "${INFO} 开始设置 iptables防火墙..."
Expand Down Expand Up @@ -410,6 +431,7 @@ _UNINSTALL() {
_IPTABLES_OPTION "DEL"
_IPTABLES_OPTION "SAVE"
fi
_ALIAS_UNSET
[[ -e "${FOLDER}" ]] && rm -rf "${FOLDER}"
if [[ -e "/etc/init.d/${NAME_SERVICE}" ]];then
if [[ "${SYSTEM_RELEASE}" = "centos" ]]; then
Expand Down