diff --git a/install.sh b/install.sh index 8e1dd3c..aaec6af 100644 --- a/install.sh +++ b/install.sh @@ -12,6 +12,7 @@ Info_font_prefix="\033[32m" && Error_font_prefix="\033[31m" && Info_background_p install_path='/root/auxpi' auxpi_path="${install_path}/build/linux" name="auxpi" +ver="2.0.1" echo -e " #================================================= @@ -34,26 +35,26 @@ function auxpi_help(){ } check_sys(){ - if [[ -f /etc/redhat-release ]]; then - release="centos" - elif cat /etc/issue | grep -q -E -i "debian"; then - release="debian" - elif cat /etc/issue | grep -q -E -i "ubuntu"; then - release="ubuntu" - elif cat /etc/issue | grep -q -E -i "centos|red hat|redhat"; then - release="centos" - elif cat /proc/version | grep -q -E -i "debian"; then - release="debian" - elif cat /proc/version | grep -q -E -i "ubuntu"; then - release="ubuntu" - elif cat /proc/version | grep -q -E -i "centos|red hat|redhat"; then - release="centos" + if [[ -f /etc/redhat-release ]]; then + release="centos" + elif cat /etc/issue | grep -q -E -i "debian"; then + release="debian" + elif cat /etc/issue | grep -q -E -i "ubuntu"; then + release="ubuntu" + elif cat /etc/issue | grep -q -E -i "centos|red hat|redhat"; then + release="centos" + elif cat /proc/version | grep -q -E -i "debian"; then + release="debian" + elif cat /proc/version | grep -q -E -i "ubuntu"; then + release="ubuntu" + elif cat /proc/version | grep -q -E -i "centos|red hat|redhat"; then + release="centos" fi - bit=$(uname -m) + bit=$(uname -m) } check_root(){ - [[ $EUID != 0 ]] && echo -e "${Error} 当前非ROOT账号(或没有ROOT权限),无法继续操作,请更换ROOT账号或使用 ${Green_background_prefix}sudo su${Font_color_suffix} 命令获取临时ROOT权限(执行后可能会提示输入当前账号的密码)。" && exit 1 + [[ $EUID != 0 ]] && echo -e "${Error} 当前非ROOT账号(或没有ROOT权限),无法继续操作,请更换ROOT账号或使用 ${Green_background_prefix}sudo su${Font_color_suffix} 命令获取临时ROOT权限(执行后可能会提示输入当前账号的密码)。" && exit 1 } function install() { @@ -61,7 +62,7 @@ function install() { check_root mkdir -p $install_path cd $install_path - wget --no-check-certificate -O "auxpi.tar.gz" "https://github.com/aimerforreimu/AUXPI/releases/download/2.0.0/auxpi-2.0.0-linux.tar.gz" + wget --no-check-certificate -O "auxpi.tar.gz" "https://github.com/aimerforreimu/AUXPI/releases/download/${ver}/auxpi-${ver}-linux.tar.gz" [[ ! -e "auxpi.tar.gz" ]] && echo -e "${Error_font_prefix}[ERROR]${Font_suffix} auxpi 下载失败" && exit 1 tar zxvf "auxpi.tar.gz" rm -rf "auxpi.tar.gz" diff --git a/models/users.go b/models/users.go index 172e7e9..50b30e9 100644 --- a/models/users.go +++ b/models/users.go @@ -17,7 +17,7 @@ type User struct { Token string `gorm:"UNIQUE" json:"token"` Version uint `json:"version"` - RoleID uint `gorm:"UNIQUE_INDEX;" json:"role_id"` + RoleID uint `gorm:"INDEX;" json:"role_id"` Role Role `json:"role"` Image []Image `json:"images" json:"image"`