├── 00.Installation ├── script │ ├── jiegua │ ├── debconf-get-selections │ ├── guazai │ ├── bdinfo │ ├── xiansu │ ├── debconf-set-selections │ ├── zuozhong │ ├── deluge-update-tracker │ └── ipv6.old ├── package │ ├── deluge │ │ ├── ddee │ │ ├── ddww │ │ └── install │ ├── qbittorrent │ │ ├── qqbb │ │ └── configure │ ├── transmission │ │ ├── ttrr │ │ ├── install │ │ └── configure │ ├── fpm │ ├── flexget │ │ ├── ffgg │ │ ├── install │ │ └── configure │ ├── rclone │ │ ├── uninstall │ │ └── install │ ├── npm │ ├── mono │ │ ├── uninstall │ │ └── install │ ├── wine │ │ ├── uninstall │ │ └── install │ ├── docker │ ├── novnc │ │ ├── install │ │ └── configure │ ├── vnstat │ │ └── install │ ├── pyenv │ └── filebrowser ├── hezi ├── options └── s-alias └── README.md /00.Installation/script/jiegua: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # https://github.com/Aniverse/inexistence 4 | # Author: Aniverse 5 | # 2019.01.22 6 | 7 | black=$(tput setaf 0); red=$(tput setaf 1); green=$(tput setaf 2); yellow=$(tput setaf 3); blue=$(tput setaf 4); magenta=$(tput setaf 5); cyan=$(tput setaf 6); white=$(tput setaf 7); bold=$(tput bold); normal=$(tput sgr0); underline=$(tput smul); reset_underline=$(tput rmul); jiacu=${normal}${bold} 8 | 9 | [[ $EUID != 0 ]] && { echo -e "${jiacu}${red}大哥,这脚本需要 root 权限 ……${normal}" ; exit 1 ; } 10 | 11 | disknumber=` df -lh | grep -c "/dev/loop" ` 12 | 13 | if [[ $disknumber == 0 ]]; then 14 | echo -e "\n${red}${bold}错误${jiacu} 看起来你当前并没有挂载什么 ISO 文件${normal}\n" 15 | else 16 | echo -e "\n${bold}检测到你当前正挂载着 ${green}${disknumber}${normal}${bold} 张原盘,脚本将会把它们全部解除挂载 ${normal}\n" 17 | for disk in ` df -lh | grep -Eo "/dev/loop[0-9]+" ` ; do 18 | ppaatthh=$(basename `df -lh | grep -E "${disk}\>" | awk '{print $6}' `) 19 | umount ${disk} && echo "已经解除对 ${cyan}${ppaatthh}${normal} 的挂载" 20 | done 21 | echo -e "\n${bold}${green}${disknumber}${normal}${bold} 张原盘已全部解除挂载 ${normal}\n" 22 | fi 23 | -------------------------------------------------------------------------------- /00.Installation/script/debconf-get-selections: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | 3 | =head1 NAME 4 | 5 | debconf-get-selections - output contents of debconf database 6 | 7 | =head1 SYNOPSIS 8 | 9 | debconf-get-selections [--installer] 10 | 11 | =head1 DESCRIPTION 12 | 13 | Output the current debconf database in a format understandable by 14 | debconf-set-selections. 15 | 16 | To dump the debconf database of the debian-installer, from 17 | /var/log/installer/cdebconf, use the --installer 18 | parameter. 19 | 20 | =cut 21 | 22 | use strict; 23 | use warnings; 24 | use Debconf::Db; 25 | use Debconf::Template; 26 | use Debconf::Question; 27 | 28 | Debconf::Db->load(readonly => "true"); 29 | 30 | my $defaultowner="unknown"; 31 | 32 | if (@ARGV && $ARGV[0] eq '--installer') { 33 | # A bit of a hack.. 34 | my $di_path; 35 | if (-d "/var/log/installer") { 36 | $di_path="/var/log/installer/cdebconf"; 37 | } else { 38 | $di_path="/var/log/debian-installer/cdebconf"; 39 | } 40 | $Debconf::Db::config=Debconf::Db->makedriver( 41 | driver => "File", 42 | name => "di_questions", 43 | filename => "$di_path/questions.dat", 44 | readonly => "true", 45 | ); 46 | $Debconf::Db::templates=Debconf::Db->makedriver( 47 | driver => "File", 48 | name => "di_templates", 49 | filename => "$di_path/templates.dat", 50 | readonly => "true", 51 | ); 52 | $defaultowner="d-i"; 53 | } 54 | 55 | my $qi = Debconf::Question->iterator; 56 | 57 | while (my $q = $qi->iterate) { 58 | my ($name, $type, $value) = ($q->name, $q->type, $q->value); 59 | next if (! length $type || $type eq 'text' || $type eq 'title'); 60 | print "# ".$q->description."\n"; 61 | if ($q->type eq 'select' || $q->type eq 'multiselect') { 62 | print "# Choices: ".join(", ", $q->choices)."\n"; 63 | } 64 | if ($q->owners) { 65 | foreach my $owner (split ", ", $q->owners) { 66 | print "$owner\t$name\t$type\t$value\n"; 67 | } 68 | } 69 | else { 70 | print "$defaultowner\t$name\t$type\t$value\n"; 71 | } 72 | } 73 | 74 | =head1 AUTHOR 75 | 76 | Petter Reinholdtsen 77 | 78 | =cut 79 | -------------------------------------------------------------------------------- /00.Installation/package/deluge/ddee: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # https://github.com/Aniverse/inexistence 4 | # Author: Aniverse 5 | # 6 | script_update=2020.07.15 7 | script_version=r10003 8 | ################################################################################################ 9 | action=$1 10 | iUser=$2 11 | if [[ -f /etc/inexistence/00.Installation/function ]]; then 12 | source /etc/inexistence/00.Installation/function 13 | else 14 | source <(wget -qO- https://github.com/Aniverse/inexistence/raw/master/00.Installation/function) 15 | fi 16 | export_inexistence_info 17 | check_var_iUser_iPass_iHome 18 | ################################################################################################ 19 | app_script=ddee 20 | app=deluge 21 | app_systemd=deluged 22 | app_command=deluged 23 | app_config=$iHome/.config/deluge/core.conf 24 | app_log=$iHome/.config/deluge/deluged.log 25 | app_daemon_port=$(sed -rn 's/(.*)"daemon_port": (.*),/\2/p' $app_config) 26 | app_version=$($app_command --version | grep deluge | awk '{print $2}' | grep -oE "[0-9].[0-9]+.[0-9]+") 27 | ################################################################################################ 28 | 29 | show_usage() { 30 | 31 | echo -e "Usage: $app_script [action] [username] 32 | 33 | Actions: 34 | a Start ${app} 35 | b Stop ${app} 36 | c Check ${app} status 37 | l View ${app}'s log 38 | r Restart ${app} 39 | s Edit ${app}'s configuration file 40 | x Enable ${app}'s auto-start after reboot 41 | y Disable ${app}'s auto-start after reboot 42 | 43 | $app_script $script_version ($script_update) 44 | User $iUser 45 | Version $app $app_version 46 | Config $app_config 47 | Logfile $app_log 48 | Torrents $iHome/.config/deluge/state 49 | Daemon Port $app_daemon_port 50 | " 51 | exit 0 52 | } 53 | 54 | [[ -z $action ]] && show_usage 55 | 56 | case $action in 57 | a ) systemctl start $app_systemd@$iUser ;; 58 | b ) systemctl stop $app_systemd@$iUser ;; 59 | c ) systemctl status $app_systemd@$iUser ;; 60 | r ) systemctl restart $app_systemd@$iUser ;; 61 | x ) systemctl enable $app_systemd@$iUser ;; 62 | y ) systemctl disable $app_systemd@$iUser ;; 63 | h ) show_usage ;; 64 | l ) tail -300 $app_log ;; 65 | s ) nano +40 $app_config ;; 66 | * ) echo -e "ERROR: Unknown action $action" ; show_usage ;; 67 | esac 68 | -------------------------------------------------------------------------------- /00.Installation/script/guazai: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Author: Aniverse 3 | # 4 | ################################################################################# 5 | script_update=2020.04.27 6 | script_version=r11001 7 | 8 | black=$(tput setaf 0); red=$(tput setaf 1); green=$(tput setaf 2); yellow=$(tput setaf 3); blue=$(tput setaf 4); magenta=$(tput setaf 5); cyan=$(tput setaf 6); white=$(tput setaf 7); bold=$(tput bold); normal=$(tput sgr0); underline=$(tput smul); reset_underline=$(tput rmul); jiacu=${normal}${bold} 9 | 10 | [[ $EUID != 0 ]] && { echo -e "${bold}${red}这脚本需要 root 权限才能运行 ……${normal}" ; exit 1 ; } 11 | 12 | # 名称转换、挂载 13 | function _file() { 14 | bdisopathlower=$(echo "$bdisopath" | sed 's/[Ii][Ss][Oo]/iso/g') 15 | file_title=$(basename "$bdisopathlower" .iso) 16 | file_title_clean="$(echo "$file_title" | tr '[:space:]' '.')" 17 | file_title_clean="$(echo "$file_title_clean" | sed s'/[.]$//')" 18 | file_title_clean="$(echo "$file_title_clean" | tr -d '(')" 19 | file_title_clean="$(echo "$file_title_clean" | tr -d ')')" 20 | mkdir -p "/bluray/mount/$file_title_clean" 21 | bdpath="/bluray/mount/$file_title_clean" 22 | mount -o ro,loop "$bdisopath" "$bdpath" # >/dev/null 2>&1 23 | echo -e "${normal}已将 ${cyan}$disk${normal} 以只读模式挂载到 ${cyan}$bdpath${normal}" 24 | } 25 | 26 | 27 | # 多文件的操作 28 | function _multi() { 29 | ALLISO=` ls | tr " " "\n" | grep -Eo ".*\.[Ii][Ss][Oo]\>" ` 30 | ISONum=` ls | tr " " "\n" | grep -c ".*\.[Ii][Ss][Oo]\>" ` 31 | if [[ $ISONum == 0 ]]; then 32 | echo -e "${bold}${red}错误${jiacu} ${words}路径下不存在 ISO 文件,退出脚本 ...${normal}\n" 33 | exit 1 34 | else 35 | echo -e "${bold}${words}路径下有 ${green}${ISONum}${normal}${bold} 个 ISO 文件,开始挂载 ...${normal}\n" 36 | for disk in $ALLISO ; do 37 | bdisopath=`echo "$disk"` && _file 38 | done 39 | echo -e "\n${bold}完成,${green}${ISONum}${normal}${bold} 个 ISO 文件已全部挂载${normal}\n" 40 | fi 41 | } 42 | 43 | 44 | # 判断输入的类型 45 | if [[ "$1" == "" ]]; then 46 | echo -e "\n${bold}未输入路径,脚本将自动挂载当前工作路径下的所有 ISO 文件${normal}\n" 47 | words=当前 && _multi 48 | elif [[ -d "$1" ]]; then 49 | echo -e "\n${bold}检测到文件夹,脚本将自动挂载该文件夹下的所有 ISO 文件${normal}\n" 50 | cd "$1" 51 | words=该 && _multi 52 | elif [[ -e "$1" ]] && [[ ! -d "$1" ]]; then 53 | echo -e "\n${bold}检测到单个 ISO 文件,脚本将挂载该 ISO 文件${normal}\n" 54 | bdisopath=`echo "$1"` ; disk=`echo "$1"` 55 | _file && echo 56 | elif [[ ! -e "$1" ]]; then 57 | echo -e "\n${bold}${red}错误${jiacu} 该文件或路径不存在,请重新输入!${normal}\n" 58 | exit 0 59 | fi 60 | 61 | -------------------------------------------------------------------------------- /00.Installation/package/deluge/ddww: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # https://github.com/Aniverse/inexistence 4 | # Author: Aniverse 5 | # 6 | script_update=2020.07.15 7 | script_version=r10004 8 | ################################################################################################ 9 | action=$1 10 | iUser=$2 11 | if [[ -f /etc/inexistence/00.Installation/function ]]; then 12 | source /etc/inexistence/00.Installation/function 13 | else 14 | source <(wget -qO- https://github.com/Aniverse/inexistence/raw/master/00.Installation/function) 15 | fi 16 | export_inexistence_info 17 | check_var_iUser_iPass_iHome 18 | ################################################################################################ 19 | app_script=ddww 20 | app=deluge-web 21 | app_systemd=deluge-web 22 | app_command=deluge-web 23 | app_config=$iHome/.config/deluge/web.conf 24 | app_log=$iHome/.config/deluge/deluge-web.log 25 | app_webui_port=$(sed -rn 's/(.*)"port": (.*),/\2/p' $app_config 2>/dev/null) 26 | app_version=$($app_command --version | grep deluge | awk '{print $2}' | grep -oE "[0-9].[0-9]+.[0-9]+") 27 | [[ -n $serveripv4 ]] && app_web_url="Web http://${serveripv4}:${app_webui_port}" 28 | ################################################################################################ 29 | 30 | show_usage() { 31 | 32 | echo -e "Usage: $app_script [action] [username] 33 | 34 | Actions: 35 | a Start ${app} 36 | b Stop ${app} 37 | c Check ${app} status 38 | l View ${app}'s log 39 | r Restart ${app} 40 | s Edit ${app}'s configuration file 41 | x Enable ${app}'s auto-start after reboot 42 | y Disable ${app}'s auto-start after reboot 43 | 44 | $app_script $script_version ($script_update) 45 | User $iUser 46 | Version $app $app_version 47 | Config $app_config 48 | Logfile $app_log 49 | WebUI Port $app_webui_port 50 | $app_web_url 51 | " 52 | exit 0 53 | } 54 | 55 | [[ -z $action ]] && show_usage 56 | 57 | case $action in 58 | a ) systemctl start $app_systemd@$iUser ;; 59 | b ) systemctl stop $app_systemd@$iUser ;; 60 | c ) systemctl status $app_systemd@$iUser ;; 61 | r ) systemctl restart $app_systemd@$iUser ;; 62 | x ) systemctl enable $app_systemd@$iUser ;; 63 | y ) systemctl disable $app_systemd@$iUser ;; 64 | h ) show_usage ;; 65 | l ) tail -300 $app_log ;; 66 | s ) nano +40 $app_config ;; 67 | * ) echo -e "ERROR: Unknown action $action" ; show_usage ;; 68 | esac 69 | -------------------------------------------------------------------------------- /00.Installation/package/qbittorrent/qqbb: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # https://github.com/Aniverse/inexistence 4 | # Author: Aniverse 5 | # 6 | script_update=2020.07.15 7 | script_version=r10006 8 | ################################################################################################ 9 | action=$1 10 | iUser=$2 11 | if [[ -f /etc/inexistence/00.Installation/function ]]; then 12 | source /etc/inexistence/00.Installation/function 13 | else 14 | source <(wget -qO- https://github.com/Aniverse/inexistence/raw/master/00.Installation/function) 15 | fi 16 | export_inexistence_info 17 | check_var_iUser_iPass_iHome 18 | ################################################################################################ 19 | app_script=qqbb 20 | app=qBittorrent 21 | app_systemd=qbittorrent 22 | app_command=qbittorrent-nox 23 | app_config=$iHome/.config/qBittorrent/qBittorrent.conf 24 | app_log=$iHome/.config/qBittorrent/qbittorrent.log 25 | app_webui_port=$(grep "WebUI.Port" $app_config | grep -oE "[0-9]+") 26 | app_version=$($app_command --version | awk '{print $2}' | sed "s/v//") 27 | [[ -n $serveripv4 ]] && app_web_url="Web http://${serveripv4}:${app_webui_port}" 28 | ################################################################################################ 29 | 30 | show_usage() { 31 | 32 | echo -e "Usage: $app_script [action] [username] 33 | 34 | Actions: 35 | a Start ${app} 36 | b Stop ${app} 37 | c Check ${app} status 38 | l View ${app}'s log 39 | r Restart ${app} 40 | s Edit ${app}'s configuration file 41 | x Enable ${app}'s auto-start after reboot 42 | y Disable ${app}'s auto-start after reboot 43 | 44 | $app_script $script_version ($script_update) 45 | User $iUser 46 | Version $app $app_version 47 | Config $app_config 48 | Logfile $app_log 49 | Torrents $iHome/.local/share/data/qBittorrent/BT_backup 50 | WebUI Port $app_webui_port 51 | $app_web_url 52 | " 53 | exit 0 54 | } 55 | 56 | [[ -z $action ]] && show_usage 57 | 58 | case $action in 59 | a ) systemctl start $app_systemd@$iUser ;; 60 | b ) systemctl stop $app_systemd@$iUser ;; 61 | c ) systemctl status $app_systemd@$iUser ;; 62 | r ) systemctl restart $app_systemd@$iUser ;; 63 | x ) systemctl enable $app_systemd@$iUser ;; 64 | y ) systemctl disable $app_systemd@$iUser ;; 65 | h ) show_usage ;; 66 | l ) tail -300 $app_log ;; 67 | s ) nano +40 $app_config ;; 68 | * ) echo -e "ERROR: Unknown action $action" ; show_usage ;; 69 | esac 70 | -------------------------------------------------------------------------------- /00.Installation/package/transmission/ttrr: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # https://github.com/Aniverse/inexistence 4 | # Author: Aniverse 5 | # 6 | script_update=2020.07.15 7 | script_version=r10003 8 | ################################################################################################ 9 | action=$1 10 | iUser=$2 11 | if [[ -f /etc/inexistence/00.Installation/function ]]; then 12 | source /etc/inexistence/00.Installation/function 13 | else 14 | source <(wget -qO- https://github.com/Aniverse/inexistence/raw/master/00.Installation/function) 15 | fi 16 | export_inexistence_info 17 | check_var_iUser_iPass_iHome 18 | ################################################################################################ 19 | app_script=ttrr 20 | app=transmission 21 | app_systemd=transmission 22 | app_command=transmission-daemon 23 | app_config=$iHome/.config/transmission-daemon/settings.json 24 | app_log=$iHome/.config/transmission-daemon/transmission.log 25 | app_webui_port=$(grep "rpc-port" $app_config | grep -oE "[0-9]+") 26 | app_version=$($app_command --help 2>&1 | head -n1 | awk '{print $2}') 27 | [[ -n $serveripv4 ]] && app_web_url="Web http://${serveripv4}:${app_webui_port}" 28 | ################################################################################################ 29 | 30 | show_usage() { 31 | echo -e "Usage: $app_script [action] [username] 32 | 33 | Actions: 34 | a Start ${app} 35 | b Stop ${app} 36 | c Check ${app} status 37 | l View ${app}'s log 38 | r Restart ${app} 39 | s Edit ${app}'s configuration file 40 | x Enable ${app}'s auto-start after reboot 41 | y Disable ${app}'s auto-start after reboot 42 | 43 | $app_script $script_version ($script_update) 44 | User $iUser 45 | Version $app $app_version 46 | Config $app_config 47 | Logfile $app_log 48 | Torrents $iHome/.config/transmission-daemon/torrents 49 | WebUI Port $app_webui_port 50 | $app_web_url 51 | " 52 | exit 0 53 | } 54 | 55 | [[ -z $action ]] && show_usage 56 | 57 | case $action in 58 | a ) systemctl start $app_systemd@$iUser ;; 59 | b ) systemctl stop $app_systemd@$iUser ;; 60 | c ) systemctl status $app_systemd@$iUser ;; 61 | r ) systemctl restart $app_systemd@$iUser ;; 62 | x ) systemctl enable $app_systemd@$iUser ;; 63 | y ) systemctl disable $app_systemd@$iUser ;; 64 | h ) show_usage ;; 65 | l ) tail -300 $app_log ;; 66 | s ) nano +40 $app_config ;; 67 | * ) echo -e "ERROR: Unknown action $action" ; show_usage ;; 68 | esac 69 | -------------------------------------------------------------------------------- /00.Installation/package/fpm: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # https://github.com/Aniverse/inexistence 4 | # Author: Aniverse 5 | 6 | script_update=2020.04.11 7 | script_version=r10001 8 | 9 | ################################################################################################ Debug 10 | 11 | usage_for_debug() { 12 | 13 | if [[ -f /etc/inexistence/00.Installation/package/fpm ]]; then 14 | bash /etc/inexistence/00.Installation/package/fpm 15 | else 16 | bash <(wget -qO- https://github.com/Aniverse/inexistence/raw/master/00.Installation/package/fpm) 17 | fi 18 | 19 | } 20 | 21 | ################################################################################################ 22 | 23 | unset LogRootPath LogTimes DebLocation SCLocation LOCKLocation OutputLOG 24 | 25 | AppName=fpm 26 | AppNameLower=fpm 27 | AppExec=fpm 28 | AppTest="$AppExec -h" 29 | Need_SourceCode=no 30 | pm_action=install 31 | 32 | function show_usage() { echo " 33 | $AppName $pm_action $script_version ($script_update) 34 | Usage: 35 | -l Specifiy LogBase (Not log file) 36 | -d Enable debug mode 37 | --log Show logfile's content" 38 | exit 1 ; } 39 | 40 | OPTS=$(getopt -o v:l:d -al version:,debug,logbase:,log -- "$@") 41 | [ ! $? = 0 ] && show_usage 42 | eval set -- "$OPTS" 43 | 44 | while [ -n "$1" ] ; do case "$1" in 45 | -v | --version ) version="$2" ; shift 2 ;; 46 | -l | --logbase ) LogTimes="$2" ; shift 2 ;; 47 | -d | --debug ) debug=1 ; shift ;; 48 | --log ) show_log=1 ; shift ;; 49 | -- ) shift ; break ;; 50 | esac ; done 51 | 52 | 53 | ################################################################################################ Set Variables 54 | 55 | if [[ -f /etc/inexistence/00.Installation/function ]]; then 56 | source /etc/inexistence/00.Installation/function 57 | else 58 | source <(wget -qO- https://github.com/Aniverse/inexistence/raw/master/00.Installation/function) 59 | fi 60 | 61 | set_variables_log_location 62 | check_var_OutputLOG 63 | debug_log_location 64 | cat_outputlog 65 | 66 | ################################################################################################ 67 | 68 | function install_fpm () { 69 | apt-get -y -q install ruby ruby-dev >> "$OutputLOG" 2>&1 70 | gem install --no-ri --no-rdoc fpm >> "$OutputLOG" 2>&1 71 | generate_status_lock 72 | } 73 | 74 | ################################################################################################ 75 | 76 | eval $AppTest > /dev/null 2>&1 77 | exit=$? 78 | if [[ $exit != 0 ]]; then 79 | echo_task "Installing $AppName ..." 80 | install_fpm & spinner $! 81 | check_status $AppNameLower 82 | fi 83 | -------------------------------------------------------------------------------- /00.Installation/package/flexget/ffgg: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # https://github.com/Aniverse/inexistence 4 | # Author: Aniverse 5 | # 6 | script_update=2020.07.15 7 | script_version=r10005 8 | ################################################################################################ 9 | action=$1 10 | iUser=$2 11 | if [[ -f /etc/inexistence/00.Installation/function ]]; then 12 | source /etc/inexistence/00.Installation/function 13 | else 14 | source <(wget -qO- https://github.com/Aniverse/inexistence/raw/master/00.Installation/function) 15 | fi 16 | export_inexistence_info 17 | check_var_iUser_iPass_iHome 18 | ################################################################################################ 19 | app_script=ffgg 20 | app=FlexGet 21 | app_systemd=flexget 22 | app_command=flexget 23 | app_config=$iHome/.config/flexget/config.yml 24 | app_log=$iHome/.config/flexget/flexget.log 25 | app_webui_port=$(grep "web_server" -A7 $app_config | grep -i port | grep -oE "[0-9]+") 26 | # app_version=$($app_command -V 2>/dev/null | head -1 | grep -oE "[0-9.]+") # check version is too slow, so only check it when needed 27 | [[ -n $serveripv4 ]] && app_web_url="Web http://${serveripv4}:${app_webui_port}" 28 | ################################################################################################ 29 | 30 | show_usage() { 31 | 32 | echo -e "Usage: $app_script [action] [username] 33 | 34 | Action: 35 | a Start ${app} 36 | b Stop ${app} 37 | c Check ${app} status 38 | l View ${app}'s log 39 | r Restart ${app} 40 | s Edit ${app}'s configuration file 41 | x Enable ${app}'s auto-start after reboot 42 | y Disable ${app}'s auto-start after reboot 43 | 44 | $app_script $script_version ($script_update) 45 | User $iUser 46 | Version $app $($app_command -V 2>/dev/null | head -1 | grep -oE "[0-9.]+") 47 | Config $app_config 48 | Logfile $app_log 49 | Plugin $iHome/.config/flexget/plugins 50 | WebUI Port $app_webui_port 51 | $app_web_url 52 | " 53 | exit 0 54 | } 55 | 56 | [[ -z $action ]] && show_usage 57 | 58 | case $action in 59 | a ) systemctl start $app_systemd@$iUser ;; 60 | b ) systemctl stop $app_systemd@$iUser ;; 61 | c ) systemctl status $app_systemd@$iUser ;; 62 | r ) systemctl restart $app_systemd@$iUser ;; 63 | x ) systemctl enable $app_systemd@$iUser ;; 64 | y ) systemctl disable $app_systemd@$iUser ;; 65 | h ) show_usage ;; 66 | l ) tail -300 $app_log ;; 67 | s ) nano +40 $app_config ;; 68 | * ) echo -e "ERROR: Unknown action $action" ; show_usage ;; 69 | esac 70 | -------------------------------------------------------------------------------- /00.Installation/package/rclone/uninstall: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # https://github.com/Aniverse/inexistence 4 | # Author: Aniverse 5 | 6 | script_update=2020.03.02 7 | script_version=r10005 8 | 9 | ################################################################################################ Debug 10 | 11 | usage_for_debug() { 12 | export local_packages=/etc/inexistence/00.Installation 13 | export s=$local_packages/package/rclone/uninstall 14 | rm -f $s ; nano $s ; bash $s 15 | } 16 | 17 | ################################################################################################ Get options 18 | 19 | unset LogRootPath LogTimes DebLocation SCLocation LOCKLocation OutputLOG 20 | 21 | AppName=rclone 22 | AppNameLower=rclone 23 | Need_SourceCode=no 24 | pm_action=uninstall 25 | 26 | function show_usage() { echo " 27 | $AppName $pm_action $script_version ($script_update) 28 | Usage: 29 | -l Specifiy LogBase 30 | -d Enable debug mode 31 | --log Show logfile's content" 32 | exit 1 ; } 33 | 34 | OPTS=$(getopt -o v:l:d -al version:,debug,logbase:,log -- "$@") 35 | [ ! $? = 0 ] && show_usage 36 | eval set -- "$OPTS" 37 | 38 | while [ -n "$1" ] ; do case "$1" in 39 | -l | --logbase ) LogTimes="$2" ; shift 2 ;; 40 | -d | --debug ) debug=1 ; shift ;; 41 | --log ) show_log=1 ; shift ;; 42 | -- ) shift ; break ;; 43 | esac ; done 44 | 45 | ################################################################################################ Set Variables 46 | 47 | if [[ -f /etc/inexistence/00.Installation/function ]]; then 48 | source /etc/inexistence/00.Installation/function 49 | else 50 | source <(wget -qO- https://github.com/Aniverse/inexistence/raw/master/00.Installation/function) 51 | fi 52 | 53 | set_variables_log_location 54 | check_var_OutputLOG 55 | debug_log_location 56 | cat_outputlog 57 | 58 | ################################################################################################ 59 | 60 | 61 | 62 | 63 | 64 | function uninstall_rclone() { 65 | echo >> $OutputLOG 66 | 67 | rm -f /usr/bin/rclone /usr/local/share/man/man1/rclone.1 $LOCKLocation/rclone.lock 68 | mandb >> $OutputLOG 2>&1 69 | 70 | status_lock=${AppNameLower}-r 71 | echo "status_lock=$status_lock" > /tmp/Variables 72 | rm -f /tmp/$status_lock.1.lock /tmp/$status_lock.2.lock 73 | { which rclone > /dev/null || touch /tmp/$status_lock.1.lock ; } && touch /tmp/$status_lock.2.lock 74 | [[ -f /tmp/$status_lock.1.lock ]] && rm -rf $LOCKLocation/$AppNameLower.lock 75 | 76 | echo >> $OutputLOG 77 | } 78 | 79 | 80 | 81 | 82 | 83 | echo_task "Uninstalling $AppName ..." 84 | uninstall_rclone & spinner $! 85 | check_status $status_lock 86 | -------------------------------------------------------------------------------- /00.Installation/package/npm: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # https://github.com/Aniverse/inexistence 4 | # Author: Aniverse 5 | 6 | script_update=2020.04.21 7 | script_version=r10000 8 | 9 | ################################################################################################ Debug 10 | 11 | usage_for_debug() { 12 | 13 | if [[ -f /etc/inexistence/00.Installation/package/npm ]]; then 14 | bash /etc/inexistence/00.Installation/package/npm 15 | else 16 | bash <(wget -qO- https://github.com/Aniverse/inexistence/raw/master/00.Installation/package/npm) 17 | fi 18 | 19 | } 20 | 21 | ################################################################################################ 22 | 23 | unset LogRootPath LogTimes DebLocation SCLocation LOCKLocation OutputLOG 24 | 25 | AppName=npm 26 | AppNameLower=npm 27 | AppExec=npm 28 | AppTest="$AppExec version" 29 | Need_SourceCode=no 30 | pm_action=install 31 | 32 | function show_usage() { echo " 33 | $AppName $pm_action $script_version ($script_update) 34 | Usage: 35 | -l Specifiy LogBase (Not log file) 36 | -d Enable debug mode 37 | --log Show logfile's content" 38 | exit 1 ; } 39 | 40 | OPTS=$(getopt -o v:l:d -al version:,debug,logbase:,log -- "$@") 41 | [ ! $? = 0 ] && show_usage 42 | eval set -- "$OPTS" 43 | 44 | while [ -n "$1" ] ; do case "$1" in 45 | -v | --version ) version="$2" ; shift 2 ;; 46 | -l | --logbase ) LogTimes="$2" ; shift 2 ;; 47 | -d | --debug ) debug=1 ; shift ;; 48 | --log ) show_log=1 ; shift ;; 49 | -- ) shift ; break ;; 50 | esac ; done 51 | 52 | ################################################################################################ Set Variables 53 | 54 | if [[ -f /etc/inexistence/00.Installation/function ]]; then 55 | source /etc/inexistence/00.Installation/function 56 | else 57 | source <(wget -qO- https://github.com/Aniverse/inexistence/raw/master/00.Installation/function) 58 | fi 59 | 60 | set_variables_log_location 61 | check_var_OutputLOG 62 | debug_log_location 63 | cat_outputlog 64 | 65 | ################################################################################################ 66 | 67 | function install_npm () { 68 | bash <(curl -sL https://deb.nodesource.com/setup_10.x) >> "$OutputLOG" 2>&1 69 | APT_UPGRADE 70 | apt_install_check nodejs build-essential 71 | apt_install_together 72 | generate_status_lock 73 | } 74 | 75 | ################################################################################################ 76 | 77 | eval $AppTest > /dev/null 2>&1 78 | exit=$? 79 | if [[ $exit != 0 ]]; then 80 | echo_task "Installing $AppName ..." 81 | install_npm & spinner $! 82 | check_status $AppNameLower 83 | fi 84 | -------------------------------------------------------------------------------- /00.Installation/script/bdinfo: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Author: Aniverse 3 | # 4 | ################################################################################# 5 | script_update=2020.03.29 6 | script_version=r11000 7 | 8 | black=$(tput setaf 0); red=$(tput setaf 1); green=$(tput setaf 2); yellow=$(tput setaf 3); blue=$(tput setaf 4) 9 | magenta=$(tput setaf 5); cyan=$(tput setaf 6); white=$(tput setaf 7); bold=$(tput bold); normal=$(tput sgr0) ; jiacu=${normal}${bold} 10 | 11 | outputpath=/log/bdinfo 12 | bdinfocli_path=/etc/abox/app/bdinfocli.exe 13 | mkdir -p $outputpath 14 | 15 | if [[ ! -e $bdinfocli_path ]]; then 16 | mkdir -p $(dirname $bdinfocli_path) 17 | wget --no-check-certificate https://github.com/Aniverse/bluray/raw/master/tools/bdinfocli.exe -qO $bdinfocli_path 18 | fi 19 | 20 | [[ ! `command -v mono` ]] && { echo -e "\n${bold}${red}警告 ${jiacu}未检测到 mono,因此无法扫描 BDinfo ...${normal}\n" ; exit 1 ; } 21 | 22 | 23 | if [[ $1 == "" ]] || [[ ! -d $1 ]]; then 24 | echo -e "\n${bold}${red}警告 ${jiacu}你必须输入 BDMV 的路径。如果路径里带空格的话还需要加上双引号${normal}\n" 25 | exit 1 26 | fi 27 | 28 | bdmvpath=`echo "$1"` 29 | file_title=`basename "$bdmvpath"` 30 | file_title_clean="$(echo "$file_title" | tr '[:space:]' '.')" 31 | file_title_clean="$(echo "$file_title_clean" | sed s'/[.]$//')" 32 | file_title_clean="$(echo "$file_title_clean" | tr -d '(')" 33 | file_title_clean="$(echo "$file_title_clean" | tr -d ')')" 34 | file_title_clean="` echo "$file_title_clean" | sed 's/\//\./' `" 35 | 36 | echo;echo 37 | mono $bdinfocli_path "$bdmvpath" $outputpath 38 | 39 | [[ ! $? -eq 0 ]] && echo "${bold}运行 BDinfo 出错,退出脚本 ...${normal}" && exit 1 40 | 41 | sed -n '/QUICK SUMMARY/,//p' "${outputpath}/BDINFO.${file_title}.txt" > temptext 42 | count=`wc -l temptext | awk '{print $1-1}' ` 43 | head -n $count temptext > "${outputpath}/${file_title_clean}.bdinfo.quick.summary.txt" 44 | rm temptext 45 | 46 | sed -n '/DISC INFO/,/FILES/p' "${outputpath}/BDINFO.${file_title}.txt" > temptext 47 | count=`wc -l temptext | awk '{print $1-2}' ` 48 | head -n $count temptext > "${outputpath}/${file_title_clean}.bdinfo.main.summary.txt" 49 | rm temptext 50 | 51 | mv "${outputpath}/BDINFO.${file_title}.txt" "${outputpath}/${file_title_clean}.bdinfo.txt" 52 | 53 | clear 54 | echo -e "${bold}扫描完成。生成的 BDinfo 报告存放在 ${blue}\"${outputpath}\"${normal}" 55 | 56 | echo -e "\n${bold}${blue}---------------------------------------- BDinfo Quick Summary ----------------------------------------${normal}\n" 57 | if [[ ! `command -v lolcat` ]]; then cat "${outputpath}/${file_title_clean}.bdinfo.quick.summary.txt" 58 | else cat "${outputpath}/${file_title_clean}.bdinfo.quick.summary.txt" | lolcat ; fi 59 | echo -e "\n${bold}${blue}------------------------------- Just copy them, no need to download it -------------------------------${normal}\n" 60 | -------------------------------------------------------------------------------- /00.Installation/package/mono/uninstall: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # https://github.com/Aniverse/inexistence 4 | # Author: Aniverse 5 | 6 | script_update=2020.03.02 7 | script_version=r10004 8 | 9 | ################################################################################################ Debug 10 | 11 | usage_for_debug() { 12 | export local_packages=/etc/inexistence/00.Installation 13 | export s=$local_packages/package/mono/uninstall 14 | rm -f $s ; nano $s ; bash $s 15 | } 16 | 17 | ################################################################################################ Get options 18 | 19 | unset LogRootPath LogTimes DebLocation SCLocation LOCKLocation OutputLOG 20 | 21 | AppName=mono 22 | AppNameLower=mono 23 | Need_SourceCode=no 24 | pm_action=uninstall 25 | 26 | function show_usage() { echo " 27 | $AppName $pm_action $script_version ($script_update) 28 | Usage: 29 | -l Specifiy LogBase (Not log file) 30 | -d Enable debug mode 31 | --log Show logfile's content" 32 | exit 1 ; } 33 | 34 | OPTS=$(getopt -o v:l:d -al version:,debug,logbase:,log -- "$@") 35 | [ ! $? = 0 ] && show_usage 36 | eval set -- "$OPTS" 37 | 38 | while [ -n "$1" ] ; do case "$1" in 39 | -v | --version ) version="$2" ; shift 2 ;; 40 | -l | --logbase ) LogTimes="$2" ; shift 2 ;; 41 | -d | --debug ) debug=1 ; shift ;; 42 | --log ) show_log=1 ; shift ;; 43 | -- ) shift ; break ;; 44 | esac ; done 45 | 46 | ################################################################################################ Set Variables 47 | 48 | if [[ -f /etc/inexistence/00.Installation/function ]]; then 49 | source /etc/inexistence/00.Installation/function 50 | else 51 | source <(wget -qO- https://github.com/Aniverse/inexistence/raw/master/00.Installation/function) 52 | fi 53 | 54 | set_variables_log_location 55 | check_var_OutputLOG 56 | debug_log_location 57 | cat_outputlog 58 | 59 | ################################################################################################ 60 | 61 | 62 | 63 | 64 | function uninstall_mono() { 65 | 66 | echo >> $OutputLOG 67 | [[ $CODENAME == jessie ]] && dpkg -r libjpeg8 >> $OutputLOG 2>&1 68 | rm -f /etc/apt/sources.list.d/mono.list 69 | APT_UPGRADE 70 | apt-get purge -y mono-complete ca-certificates-mono >> $OutputLOG 2>&1 71 | apt-get autoremove -y >> $OutputLOG 2>&1 72 | 73 | status_lock=${AppNameLower}-r 74 | echo "status_lock=$status_lock" > /tmp/Variables 75 | rm -f /tmp/$status_lock.1.lock /tmp/$status_lock.2.lock 76 | { which mono > /dev/null || touch /tmp/$status_lock.1.lock ; } && touch /tmp/$status_lock.2.lock 77 | [[ -f /tmp/$status_lock.1.lock ]] && rm -rf $LOCKLocation/$AppNameLower.lock 78 | echo >> $OutputLOG 79 | 80 | } 81 | 82 | 83 | 84 | 85 | 86 | echo_task "Uninstalling $AppName ..." 87 | uninstall_mono & spinner $! 88 | check_status $status_lock 89 | -------------------------------------------------------------------------------- /00.Installation/package/wine/uninstall: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # https://github.com/Aniverse/inexistence 4 | # Author: Aniverse 5 | 6 | script_update=2020.03.02 7 | script_version=r10004 8 | 9 | ################################################################################################ Debug 10 | 11 | usage_for_debug() { 12 | export local_packages=/etc/inexistence/00.Installation 13 | export s=$local_packages/package/wine/uninstall 14 | rm -f $s ; nano $s ; bash $s 15 | } 16 | 17 | ################################################################################################ Get options 18 | 19 | unset LogRootPath LogTimes DebLocation SCLocation LOCKLocation OutputLOG 20 | 21 | AppName=wine 22 | AppNameLower=wine 23 | Need_SourceCode=no 24 | pm_action=uninstall 25 | 26 | function show_usage() { echo " 27 | $AppName $pm_action $script_version ($script_update) 28 | Usage: 29 | -l Specifiy LogBase 30 | -d Enable debug mode 31 | --log Show logfile's content" 32 | exit 1 ; } 33 | 34 | OPTS=$(getopt -o v:l:d -al version:,debug,logbase:,log -- "$@") 35 | [ ! $? = 0 ] && show_usage 36 | eval set -- "$OPTS" 37 | 38 | while [ -n "$1" ] ; do case "$1" in 39 | -v | --version ) version="$2" ; shift 2 ;; 40 | -l | --logbase ) LogTimes="$2" ; shift 2 ;; 41 | -d | --debug ) debug=1 ; shift ;; 42 | --log ) show_log=1 ; shift ;; 43 | -- ) shift ; break ;; 44 | esac ; done 45 | 46 | ################################################################################################ Set Variables 47 | 48 | if [[ -f /etc/inexistence/00.Installation/function ]]; then 49 | source /etc/inexistence/00.Installation/function 50 | else 51 | source <(wget -qO- https://github.com/Aniverse/inexistence/raw/master/00.Installation/function) 52 | fi 53 | 54 | set_variables_log_location 55 | [[ $debug == 1 ]] && debug_log_location 56 | 57 | ################################################################################################ 58 | 59 | 60 | 61 | 62 | 63 | function uninstall_wine() { 64 | 65 | echo >> $OutputLOG 66 | 67 | #if [[ $DISTRO == Ubuntu ]]; then 68 | # apt-add-repository -ry https://dl.winehq.org/wine-builds/ubuntu/ >> $OutputLOG 2>&1 69 | #elif [[ $DISTRO == Debian ]]; then 70 | # rm -f /etc/apt/sources.list.d/wine.list >> $OutputLOG 2>&1 71 | #fi 72 | 73 | rm -f /etc/apt/sources.list.d/wine.list /usr/local/bin/winetricks 74 | 75 | APT_UPGRADE 76 | apt-get purge -y winehq-stable >> $OutputLOG 2>&1 77 | apt-get autoremove -y >> $OutputLOG 2>&1 78 | 79 | status_lock=${AppNameLower}-r 80 | echo "status_lock=$status_lock" > /tmp/Variables 81 | rm -f /tmp/$status_lock.1.lock /tmp/$status_lock.2.lock 82 | { which wine > /dev/null || touch /tmp/$status_lock.1.lock ; } && touch /tmp/$status_lock.2.lock 83 | [[ -f /tmp/$status_lock.1.lock ]] && rm -rf $LOCKLocation/$AppNameLower.lock 84 | echo >> $OutputLOG 85 | 86 | } 87 | 88 | 89 | 90 | 91 | 92 | echo_task "Uninstalling $AppName ..." 93 | uninstall_wine & spinner $! 94 | check_status $status_lock 95 | -------------------------------------------------------------------------------- /00.Installation/package/docker: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # https://github.com/Aniverse/inexistence 4 | # Author: Aniverse 5 | 6 | script_update=2020.04.15 7 | script_version=r11002 8 | 9 | ################################################################################################ Debug 10 | 11 | usage_for_debug() { 12 | 13 | if [[ -f /etc/inexistence/00.Installation/package/docker ]]; then 14 | bash /etc/inexistence/00.Installation/package/docker 15 | else 16 | bash <(wget -qO- https://github.com/Aniverse/inexistence/raw/master/00.Installation/package/docker) 17 | fi 18 | 19 | } 20 | 21 | ################################################################################################ 22 | 23 | unset LogRootPath LogTimes DebLocation SCLocation LOCKLocation OutputLOG 24 | 25 | AppName=Docker 26 | AppNameLower=docker 27 | AppExec=docker 28 | AppTest="$AppExec -h" 29 | Need_SourceCode=no 30 | pm_action=install 31 | 32 | function show_usage() { echo " 33 | $AppName $pm_action $script_version ($script_update) 34 | Usage: 35 | -l Specifiy LogBase (Not log file) 36 | -d Enable debug mode 37 | --log Show logfile's content" 38 | exit 1 ; } 39 | 40 | OPTS=$(getopt -o v:l:d -al version:,debug,logbase:,log -- "$@") 41 | [ ! $? = 0 ] && show_usage 42 | eval set -- "$OPTS" 43 | 44 | while [ -n "$1" ] ; do case "$1" in 45 | -v | --version ) version="$2" ; shift 2 ;; 46 | -l | --logbase ) LogTimes="$2" ; shift 2 ;; 47 | -d | --debug ) debug=1 ; shift ;; 48 | --log ) show_log=1 ; shift ;; 49 | -- ) shift ; break ;; 50 | esac ; done 51 | 52 | ################################################################################################ Set Variables 53 | 54 | if [[ -f /etc/inexistence/00.Installation/function ]]; then 55 | source /etc/inexistence/00.Installation/function 56 | else 57 | source <(wget -qO- https://github.com/Aniverse/inexistence/raw/master/00.Installation/function) 58 | fi 59 | 60 | set_variables_log_location 61 | check_var_OutputLOG 62 | debug_log_location 63 | cat_outputlog 64 | 65 | ################################################################################################ 66 | 67 | function install_docker () { 68 | # curl -sSL https://get.docker.com/ | sh >> "$OutputLOG" 2>&1 69 | apt_install_check apt-transport-https ca-certificates curl gnupg2 70 | apt_install_together 71 | curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - >> "$OutputLOG" 2>&1 72 | echo "deb [arch=amd64] https://download.docker.com/linux/${DISTROL} ${CODENAME} stable" > /etc/apt/sources.list.d/docker.list 73 | APT_UPGRADE 74 | apt_install_check docker-ce docker-ce-cli containerd.io 75 | apt_install_together 76 | generate_status_lock 77 | } 78 | 79 | ################################################################################################ 80 | 81 | eval $AppTest > /dev/null 2>&1 82 | exit=$? 83 | if [[ $exit != 0 ]]; then 84 | echo_task "Installing $AppName ..." 85 | install_docker & spinner $! 86 | check_status $AppNameLower 87 | fi 88 | -------------------------------------------------------------------------------- /00.Installation/script/xiansu: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # https://github.com/Aniverse/inexistence 4 | # Author: Aniverse 5 | # 6 | ################################################################################# 7 | 8 | script_update=2020.07.18 9 | script_version=r20003 10 | 11 | black=$(tput setaf 0); red=$(tput setaf 1); green=$(tput setaf 2); yellow=$(tput setaf 3) 12 | blue=$(tput setaf 4); magenta=$(tput setaf 5); cyan=$(tput setaf 6); white=$(tput setaf 7) 13 | bold=$(tput bold); normal=$(tput sgr0); jiacu=${normal}${bold} 14 | 15 | uploadrate=$1 16 | interface=$2 17 | 18 | if [[ -z $interface ]] ;then 19 | wangka1=$(cat /proc/net/dev | sort -rn -k2 | head -1 | awk -F':' '{print $1}') 20 | wangka2=$(ip addr 2>&1 | grep -B2 $(ip route get 1 2>&1 | sed -n 's/^.*src \([0-9.]*\) .*$/\1/p') | grep -i broadcast | cut -d: -f 2 | cut -d@ -f 1 | sed 's/ //g') 21 | interface=$wangka1 22 | [[ -n $wangka2 ]] && interface=$wangka2 23 | fi 24 | 25 | ################################################################################# 26 | 27 | default_speed=50 28 | 29 | if [[ -z $( command -v tc ) ]]; then 30 | echo -e "\n${bold}${red}警告 ${jiacu}未检测到 tc ,限速命令无法执行${normal}\n" 31 | exit 1 32 | fi 33 | 34 | ################################################################################# 35 | 36 | 37 | 38 | function limit_speed(){ 39 | burstspeed=$(($uploadrate/10)) 40 | burstspeedmbit=`echo ${burstspeed}mbit` 41 | uploadratembit=`echo ${uploadrate}mbit` 42 | tc qdisc del dev $interface root >> /dev/null 2>&1 43 | tc qdisc add dev $interface root handle 1: tbf rate $uploadratembit burst $burstspeedmbit latency 1s >> /dev/null 2>&1 44 | tc qdisc add dev $interface parent 1: handle 11: pfifo_fast >> /dev/null 2>&1 45 | } 46 | 47 | 48 | if [[ -n $uploadrate ]]; then 49 | limit_speed 50 | else 51 | echo -e "${bold}" 52 | echo -e "${green}(01) ${jiacu}限制全局上传速度" 53 | echo -e "${green}(02) ${jiacu}解除全局上传限速" 54 | echo -e "${green}(03) ${jiacu}退出" 55 | echo -e "" 56 | echo -ne "${yellow}${bold}你想做什么? (默认选择解除限速)${normal} "; read response 57 | 58 | case $response in 59 | 1 | 01) xxxsp=1 ;; 60 | 2 | 02 | "") xxxsp=2 ;; 61 | 3 | 03) xxxsp=3 ;; 62 | *) xxxsp=2 ;; 63 | esac 64 | 65 | if [ "${xxxsp}" == "1" ]; then 66 | echo 67 | read -ep "${bold}请输入你要限速的网卡名字,一般用默认的就可以了:${yellow}" -i $interface interface 68 | if ! ifconfig | grep $interface -q ;then 69 | echo; echo "${bold}${red}警告 ${jiacu}未检测到名为 ${green}${interface}${jiacu} 的网卡 ,限速命令无法执行${normal}"; echo 70 | exit 1 71 | fi 72 | echo -ne "${normal}" 73 | read -ep "${bold}请输入你要限制的上行网速(Mbps):${yellow}" -i $default_speed uploadrate 74 | echo -e "${normal}" 75 | limit_speed 76 | echo "${bold}${green}已将全局上传速度限制到 ${uploadrate}Mbps${normal}"; echo 77 | elif [ "${xxxsp}" == "2" ]; then 78 | echo; read -e -p "${bold}请输入你要解除限速的网卡名字:${yellow}" -i $interface interface 79 | tc qdisc del dev $interface root >> /dev/null 2>&1 80 | echo; echo -e "${bold}${green}全局限速应该已经解除了${normal}"; echo 81 | else 82 | exit 0 83 | fi 84 | fi 85 | -------------------------------------------------------------------------------- /00.Installation/package/rclone/install: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # https://github.com/Aniverse/inexistence 4 | # Author: Aniverse 5 | 6 | script_update=2020.03.02 7 | script_version=r11010 8 | 9 | ################################################################################################ Debug 10 | 11 | usage_for_debug() { 12 | export local_packages=/etc/inexistence/00.Installation 13 | export s=$local_packages/package/rclone/install 14 | rm -f $s ; nano $s ; bash $s 15 | bash <(wget -qO- https://github.com/Aniverse/inexistence/raw/master/00.Installation/package/rclone/install) 16 | } 17 | 18 | ################################################################################################ Get options 19 | 20 | unset LogRootPath LogTimes DebLocation SCLocation LOCKLocation OutputLOG 21 | 22 | AppName=rclone 23 | AppNameLower=rclone 24 | Need_SourceCode=no 25 | pm_action=install 26 | 27 | function show_usage() { echo " 28 | $AppName $pm_action $script_version ($script_update) 29 | Usage: 30 | -v Specifiy which version to be installed 31 | -l Specifiy LogBase 32 | -d Enable debug mode 33 | " 34 | exit 1 ; } 35 | 36 | OPTS=$(getopt -o v:l:d -al version:,debug,logbase:,log -- "$@") 37 | [ ! $? = 0 ] && show_usage 38 | eval set -- "$OPTS" 39 | 40 | while [ -n "$1" ] ; do case "$1" in 41 | -v | --version ) version="$2" ; shift 2 ;; 42 | -l | --logbase ) LogTimes="$2" ; shift 2 ;; 43 | -d | --debug ) debug=1 ; shift ;; 44 | --log ) show_log=1 ; shift ;; 45 | -- ) shift ; break ;; 46 | esac ; done 47 | 48 | ################################################################################################ Set Variables 49 | 50 | if [[ -f /etc/inexistence/00.Installation/function ]]; then 51 | source /etc/inexistence/00.Installation/function 52 | else 53 | source <(wget -qO- https://github.com/Aniverse/inexistence/raw/master/00.Installation/function) 54 | fi 55 | 56 | set_variables_log_location 57 | check_var_OutputLOG 58 | debug_log_location 59 | cat_outputlog 60 | 61 | ################################################################################################ 62 | 63 | 64 | 65 | 66 | function install_rclone() { 67 | echo >> $OutputLOG 68 | cd /tmp 69 | 70 | wget -nv https://downloads.rclone.org/rclone-current-linux-amd64.zip -O rclone-current-linux-amd64.zip >> $OutputLOG 2>&1 71 | unzip rclone-current-linux-amd64.zip >> $OutputLOG 2>&1 72 | cd rclone-*-linux-amd64 >> $OutputLOG 2>&1 73 | cp rclone /usr/bin/ >> $OutputLOG 2>&1 74 | chown root:root /usr/bin/rclone >> $OutputLOG 2>&1 75 | chmod 755 /usr/bin/rclone >> $OutputLOG 2>&1 76 | mkdir -p /usr/local/share/man/man1 >> $OutputLOG 2>&1 77 | cp rclone.1 /usr/local/share/man/man1 >> $OutputLOG 2>&1 78 | mandb >> $OutputLOG 2>&1 79 | cd .. 80 | rm -rf rclone-*-linux-amd64 rclone-current-linux-amd64.zip 81 | 82 | status_lock=$AppNameLower 83 | echo "status_lock=$status_lock" > /tmp/Variables 84 | rm -f /tmp/$status_lock.1.lock /tmp/$status_lock.2.lock 85 | which rclone > /dev/null && touch /tmp/$status_lock.1.lock || touch /tmp/$status_lock.2.lock 86 | [[ -f /tmp/$status_lock.1.lock ]] && touch $LOCKLocation/$AppNameLower.lock 87 | echo >> $OutputLOG 88 | } 89 | 90 | 91 | 92 | 93 | echo_task "Installing $AppName ..." 94 | install_rclone & spinner $! 95 | check_status $status_lock 96 | -------------------------------------------------------------------------------- /00.Installation/script/debconf-set-selections: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | # This file was preprocessed, do not edit! 3 | 4 | 5 | sub usage { 6 | print STDERR <get($label); 46 | if (! $template) { 47 | $template=Debconf::Template->new($label, $owner, $type); 48 | $template->description("Dummy template"); 49 | $template->extended_description("This is a fake template used to pre-seed the debconf database. If you are seeing this, something is probably wrong."); 50 | } 51 | $template->type($type); 52 | 53 | my $question=Debconf::Question->get($label); 54 | if (! $question) { 55 | error("Cannot find a question for $label"); 56 | return; 57 | } 58 | $question->addowner($owner, $type); 59 | $question->value($content); 60 | if (! $unseen) { 61 | $question->flag("seen", "true"); 62 | } 63 | } 64 | 65 | sub set_flag { 66 | my ($owner, $label, $flag, $content) = @_; 67 | 68 | info "Setting $flag flag"; 69 | 70 | my $question=Debconf::Question->get($label); 71 | if (! $question) { 72 | error("Cannot find a question for $label"); 73 | return; 74 | } 75 | $question->flag($flag, $content); 76 | } 77 | 78 | my @knowntypes = qw(select boolean string multiselect note password text title); 79 | my @knownflags = qw(seen); 80 | 81 | sub ok_format { 82 | my ($owner, $label, $type, $content) = @_; 83 | if (! defined $owner || ! defined $label || ! defined $content) { 84 | error "parse error on line $.: '$_'"; 85 | return; 86 | } 87 | elsif (! grep { $_ eq $type } @knowntypes, @knownflags) { 88 | warning "Unknown type $type, skipping line $."; 89 | return; 90 | } 91 | else { 92 | return 1; 93 | } 94 | } 95 | 96 | sub mungeline ($) { 97 | my $line=shift; 98 | chomp $line; 99 | $line=~s/\r$//; 100 | return $line; 101 | } 102 | 103 | 104 | GetOptions( 105 | "verbose|v" => \$debug, 106 | "checkonly|c" => \$checkonly, 107 | "unseen|u" => \$unseen, 108 | ) || usage(); 109 | 110 | Debconf::Db->load; 111 | 112 | $error = 0; 113 | 114 | while (<>) { 115 | $_=mungeline($_); 116 | while (/\\$/ && ! eof) { 117 | s/\\$//; 118 | $_.=mungeline(<>); 119 | } 120 | next if /^\s*$/ || /^\s*\#/; 121 | my ($owner, $label, $type, $content) = /^\s*(\S+)\s+(\S+)\s+(\S+)(?:\s(.*))?/; 122 | if (! defined $content) { 123 | $content=''; 124 | } 125 | if (ok_format($owner, $label, $type, $content)) { 126 | if (grep { $_ eq $type } @knownflags) { 127 | info "Trying to set '$type' flag to '$content'"; 128 | set_flag($owner, $label, $type, $content); 129 | } 130 | else { 131 | info "Trying to set '$label' [$type] to '$content'"; 132 | load_answer($owner, $label, $type, $content); 133 | } 134 | } 135 | } 136 | 137 | if (! $checkonly) { 138 | Debconf::Db->save; 139 | } 140 | 141 | if ($error) { 142 | exit 1; 143 | } 144 | 145 | -------------------------------------------------------------------------------- /00.Installation/package/mono/install: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # https://github.com/Aniverse/inexistence 4 | # Author: Aniverse 5 | 6 | script_update=2020.03.02 7 | script_version=r10006 8 | 9 | ################################################################################################ Debug 10 | 11 | usage_for_debug() { 12 | export local_packages=/etc/inexistence/00.Installation 13 | export s=$local_packages/package/mono/install 14 | rm -f $s ; nano $s ; bash $s 15 | bash <(wget -qO- https://github.com/Aniverse/inexistence/raw/master/00.Installation/package/mono/install) 16 | } 17 | 18 | ################################################################################################ Get options 19 | 20 | unset LogRootPath LogTimes DebLocation SCLocation LOCKLocation OutputLOG 21 | 22 | AppName=mono 23 | AppNameLower=mono 24 | Need_SourceCode=no 25 | pm_action=install 26 | 27 | function show_usage() { echo " 28 | $AppName $pm_action $script_version ($script_update) 29 | Usage: 30 | -l Specifiy LogBase (Not log file) 31 | -d Enable debug mode 32 | --log Show logfile's content" 33 | exit 1 ; } 34 | 35 | OPTS=$(getopt -o v:l:d -al version:,debug,logbase:,log -- "$@") 36 | [ ! $? = 0 ] && show_usage 37 | eval set -- "$OPTS" 38 | 39 | while [ -n "$1" ] ; do case "$1" in 40 | -v | --version ) version="$2" ; shift 2 ;; 41 | -l | --logbase ) LogTimes="$2" ; shift 2 ;; 42 | -d | --debug ) debug=1 ; shift ;; 43 | --log ) show_log=1 ; shift ;; 44 | -- ) shift ; break ;; 45 | esac ; done 46 | 47 | ################################################################################################ Set Variables 48 | 49 | if [[ -f /etc/inexistence/00.Installation/function ]]; then 50 | source /etc/inexistence/00.Installation/function 51 | else 52 | source <(wget -qO- https://github.com/Aniverse/inexistence/raw/master/00.Installation/function) 53 | fi 54 | 55 | set_variables_log_location 56 | check_var_OutputLOG 57 | debug_log_location 58 | cat_outputlog 59 | 60 | ################################################################################################ 61 | 62 | 63 | 64 | 65 | 66 | # http://www.mono-project.com/download/stable/#download-lin 67 | # https://download.mono-project.com/sources/mono/ 68 | # http://www.mono-project.com/docs/compiling-mono/compiling-from-git/ 69 | # https://github.com/liaralabs/swizzin/blob/master/sources/functions/mono 70 | 71 | function install_mono() { 72 | echo >> $OutputLOG 73 | 74 | if [[ $CODENAME == jessie ]]; then 75 | wget -O libjpeg8.deb -nv http://ftp.fr.debian.org/debian/pool/main/libj/libjpeg8/libjpeg8_8d-1+deb7u1_amd64.deb >> $OutputLOG 2>&1 76 | dpkg -i libjpeg8.deb >> $OutputLOG 2>&1 77 | rm -f libjpeg8.deb 78 | fi 79 | 80 | # apt-key --keyring /etc/apt/trusted.gpg.d/mono-xamarin.gpg adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF >> $OutputLOG 2>&1 81 | apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF >> $OutputLOG 2>&1 82 | 83 | # echo "deb https://download.mono-project.com/repo/$DISTROL $CODENAME/snapshots/5.18/. main" > /etc/apt/sources.list.d/mono.list 84 | if [[ $CODENAME != focal ]]; then 85 | echo "deb http://download.mono-project.com/repo/$DISTROL stable-$CODENAME main" > /etc/apt/sources.list.d/mono.list 86 | fi 87 | 88 | APT_UPGRADE 89 | apt_install_check mono-complete ca-certificates-mono 90 | apt_install_separate # && touch /tmp/$status_lock.1.lock || touch /tmp/$status_lock.2.lock 91 | 92 | # mono --version 2>&1 | head -n1 | awk '{print $5}' 93 | 94 | status_lock=$AppNameLower 95 | echo "status_lock=$status_lock" > /tmp/Variables 96 | rm -f /tmp/$status_lock.1.lock /tmp/$status_lock.2.lock 97 | which mono > /dev/null && touch /tmp/$status_lock.1.lock || touch /tmp/$status_lock.2.lock 98 | [[ -f /tmp/$status_lock.1.lock ]] && touch $LOCKLocation/$AppNameLower.lock 99 | 100 | echo >> $OutputLOG 101 | } 102 | 103 | 104 | 105 | 106 | 107 | echo_task "Installing $AppName ..." 108 | install_mono & spinner $! 109 | check_status $status_lock 110 | -------------------------------------------------------------------------------- /00.Installation/script/zuozhong: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # https://github.com/Aniverse/inexistence 4 | # Author: Aniverse 5 | ################################################################################################ 6 | script_update=2020.03.29 7 | script_version=r11002 8 | outputpath="/log/torrents" 9 | ################################################################################################ 10 | black=$(tput setaf 0); red=$(tput setaf 1); green=$(tput setaf 2); yellow=$(tput setaf 3); blue=$(tput setaf 4) 11 | magenta=$(tput setaf 5); cyan=$(tput setaf 6); white=$(tput setaf 7); bold=$(tput bold); normal=$(tput sgr0); jiacu=${normal}${bold} 12 | 13 | [[ -z $1 ]] && { echo -e "\n${red}${bold}WARNING${jiacu} You must input a path to your file${normal}\n" ; exit 1 ; } 14 | piece_size=$2 15 | [[ -z $piece_size ]] && piece_size=24 16 | #[[ $3 == -d ]] && DeBUG=1 17 | [[ ! $(which mktorrent) ]] && { echo -e "No mktorrent found in PATH!" ; exit 1; } 18 | ################################################################################################ 19 | 20 | mkdir -p $outputpath 21 | 22 | filepath=`echo "$1"` 23 | file_title=$(basename "$filepath") 24 | file_title_clean="$(echo "$file_title" | tr '[:space:]' '.')" 25 | file_title_clean="$(echo "$file_title_clean" | sed s'/[.]$//')" 26 | file_title_clean="$(echo "$file_title_clean" | tr -d '(')" 27 | file_title_clean="$(echo "$file_title_clean" | tr -d ')')" 28 | file_title_clean="` echo "$file_title_clean" | sed 's/\//\./' `" 29 | 30 | # Ask for Tracker 31 | echo -e " 32 | 01) ${cyan}Create a new torrent with empty announce${normal} 33 | 02) ${cyan}Create a new torrent and specify an announce${normal} 34 | 11) ${cyan}Create a new torrent for HD-Torrents${normal} 35 | 12) ${cyan}Create a new torrent for Classix-Unlimited${normal} 36 | 99) ${cyan}Create a new torrent for public trackers${normal}" 37 | echo -ne "${yellow}${bold}Which tracker would you like to use?${normal} (Default: ${cyan}01${normal}) "; read -e responce 38 | 39 | case $responce in 40 | 01 | 1 ) ANNOUNCE="-a \"\"" 41 | echo -e "The script will create a new torrent with empty announce" ;; 42 | 02 | 2 ) echo "${yellow}${bold}" ; read -e -p "Input your tracker announce: ${normal}${blue}" TRACKERA ; echo "${normal}" ; ANNOUNCE="-a $TRACKERA" 43 | echo -e "The script will create a new torrent with the announce you input" ;; 44 | 11 ) ANNOUNCE="-a http://hdts-announce.ru/announce.php" 45 | echo -e "The script will create a new torrent with HD-Torrents' announce" ;; 46 | 12 ) ANNOUNCE="-a http://classix-unlimited.co.uk/announce.php" 47 | echo -e "The script will create a new torrent with Classix-Unlimited' announce" ;; 48 | 99 ) ANNOUNCE="-a udp://tracker.coppersurfer.tk:6969/announce -a http://open.kickasstracker.com:80/announce -a http://bt.dl1234.com:80/announce -a udp://tracker.safe.moe:6969/announce -a udp://9.rarbg.to:2710/announce -a udp://tracker.piratepublic.com:1337/announce -a http://tracker.opentrackr.org:1337/announce -a http://retracker.telecom.by:80/announce -a https://open.acgnxtracker.com:443/announce -a udp://tracker.xku.tv:6969/announce -a udp://thetracker.org:80/announce -a udp://bt.xxx-tracker.com:2710/announce -a http://0d.kebhana.mx:443/announce -a http://share.camoe.cn:8080/announce -a udp://inferno.demonoid.pw:3418/announce -a udp://tracker.cypherpunks.ru:6969/announce" 49 | echo -e "The script will create a new torrent with public trackers' announce" ;; 50 | "" | * ) newtorrent=Yes; ANNOUNCE="-a \"\"" ;; 51 | esac 52 | 53 | echo 54 | starttime=$(date +%s) 55 | 56 | #[[ $DeBUG == 1 ]] && echo "ANNOUNCE=$ANNOUNCE" 57 | mktorrent -v -p -l $piece_size $ANNOUNCE -o "${outputpath}/$file_title_clean.torrent" "$filepath" 58 | if [ ! $? -eq 0 ];then exit 1; else 59 | 60 | endtime=$(date +%s) 61 | timeused=$(( $endtime - $starttime )) 62 | 63 | clear 64 | echo -e "${bold}Done. Created torrent is stored in ${yellow}\"${outputpath}\"${normal}" 65 | if [[ $timeused -gt 60 && $timeused -lt 3600 ]]; then 66 | timeusedmin=$(expr $timeused / 60) 67 | timeusedsec=$(expr $timeused % 60) 68 | echo -e "${bold}Time used ${timeusedmin} min ${timeusedsec} sec${normal}" 69 | elif [[ $timeused -ge 3600 ]]; then 70 | timeusedhour=$(expr $timeused / 3600) 71 | timeusedmin=$(expr $(expr $timeused % 3600) / 60) 72 | timeusedsec=$(expr $timeused % 60) 73 | echo -e "${bold}Time used ${timeusedhour} hour ${timeusedmin} min ${timeusedsec} sec${normal}" 74 | else 75 | echo -e "${bold}Time used ${timeused} sec${normal}" 76 | fi 77 | 78 | echo 79 | 80 | fi 81 | 82 | 83 | debug_used() { 84 | 85 | echo -n > $(which zuozhong) ; nano $(which zuozhong) 86 | rm -f *torrent 87 | touch 1 88 | zuozhong 1 89 | 90 | } 91 | -------------------------------------------------------------------------------- /00.Installation/package/novnc/install: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # https://github.com/Aniverse/inexistence 4 | # Author: Aniverse 5 | 6 | script_update=2020.03.16 7 | script_version=r10006 8 | 9 | ################################################################################################ Debug 10 | 11 | usage_for_debug() { 12 | export local_packages=/etc/inexistence/00.Installation 13 | export s=$local_packages/package/novnc/install 14 | rm -f $s ; nano $s ; bash $s 15 | bash /etc/inexistence/00.Installation/package/novnc/install 16 | bash <(wget -qO- https://github.com/Aniverse/inexistence/raw/master/00.Installation/package/novnc/install) 17 | } 18 | 19 | ################################################################################################ Get options 20 | 21 | unset LogRootPath LogTimes DebLocation SCLocation LOCKLocation OutputLOG 22 | 23 | AppName=noVNC 24 | AppNameLower=novnc 25 | Need_SourceCode=yes 26 | pm_action=install 27 | 28 | function show_usage() { echo " 29 | $AppName $pm_action $script_version ($script_update) 30 | Usage: 31 | -l Specifiy LogBase (Not log file) 32 | -d Enable debug mode 33 | --log Show logfile's content" 34 | exit 1 ; } 35 | 36 | OPTS=$(getopt -o v:l:d -al version:,debug,logbase:,log -- "$@") 37 | [ ! $? = 0 ] && show_usage 38 | eval set -- "$OPTS" 39 | 40 | while [ -n "$1" ] ; do case "$1" in 41 | -v | --version ) version="$2" ; shift 2 ;; 42 | -l | --logbase ) LogTimes="$2" ; shift 2 ;; 43 | -d | --debug ) debug=1 ; shift ;; 44 | --log ) show_log=1 ; shift ;; 45 | -- ) shift ; break ;; 46 | esac ; done 47 | 48 | ################################################################################################ Set Variables 49 | 50 | if [[ -f /etc/inexistence/00.Installation/function ]]; then 51 | source /etc/inexistence/00.Installation/function 52 | else 53 | source <(wget -qO- https://github.com/Aniverse/inexistence/raw/master/00.Installation/function) 54 | fi 55 | 56 | set_variables_log_location 57 | check_var_OutputLOG 58 | debug_log_location 59 | cat_outputlog 60 | 61 | ################################################################################################ 62 | 63 | 64 | 65 | 66 | function install_novnc() { 67 | echo >> $OutputLOG 68 | 69 | if [[ $DISTRO == "Ubuntu" ]]; then 70 | apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0x0AB215679C571D1C8325275B9BDB3D89CE49EC21 >> "$OutputLOG" 2>&1 71 | add-apt-repository ppa:mozillateam/ppa -y >> "$OutputLOG" 2>&1 72 | fi 73 | 74 | APT_UPGRADE 75 | 76 | if [[ $CODENAME == bionic ]]; then 77 | apt_install_check libappindicator-dev 78 | apt_install_separate 79 | fi 80 | 81 | apt_install_check xfce4 xfce4-goodies tightvncserver fonts-noto firefox-esr expect unzip git python \ 82 | dbus-x11 xfonts-base xinit xserver-xorg xserver-xorg-legacy x11-xserver-utils iptables-persistent 83 | apt_install_separate 84 | 85 | wget -nv -O master.zip 'https://github.com/novnc/noVNC/archive/master.zip' >> "$OutputLOG" 2>&1 86 | unzip master.zip >> "$OutputLOG" 2>&1 87 | rm -rf master.zip >> "$OutputLOG" 2>&1 88 | mkdir -p ${web_root} >> "$OutputLOG" 2>&1 89 | mv noVNC-master ${web_root}/novnc/ >> "$OutputLOG" 2>&1 90 | 91 | cat << EOF > /tmp/openssl.cnf 92 | [ req ] 93 | prompt = no 94 | distinguished_name = req_distinguished_name 95 | [ req_distinguished_name ] 96 | C = US 97 | ST = Some State 98 | L = LOCALLY 99 | O = SELF 100 | OU = SELF 101 | CN = SELF 102 | emailAddress = private@example.com 103 | EOF 104 | # echo_info "Generating self-signed certificate for noVNC security..." 105 | openssl req -config /tmp/openssl.cnf -newkey rsa:1024 -x509 -days 1095 -nodes \ 106 | -out ${web_root}/novnc/utils/self.pem -keyout ${web_root}/novnc/utils/self.pem >> "$OutputLOG" 2>&1 107 | chown www-data:www-data -R ${web_root}/novnc/ >> "$OutputLOG" 2>&1 108 | chmod +rx ${web_root}/novnc/utils/launch.sh >> "$OutputLOG" 2>&1 109 | 110 | status_lock=$AppNameLower 111 | echo "status_lock=$status_lock" > /tmp/Variables 112 | rm -f /tmp/$status_lock.1.lock /tmp/$status_lock.2.lock 113 | [[ -n $(which vncserver) ]] && [[ -f ${web_root}/novnc/utils/self.pem ]] && touch /tmp/$status_lock.1.lock || touch /tmp/$status_lock.2.lock 114 | [[ -f /tmp/$status_lock.1.lock ]] && touch $LOCKLocation/$AppNameLower.lock 115 | 116 | echo >> $OutputLOG 117 | } 118 | 119 | 120 | 121 | 122 | 123 | echo_task "Installing $AppName ..." 124 | install_novnc & spinner $! 125 | check_status $status_lock 126 | -------------------------------------------------------------------------------- /00.Installation/script/deluge-update-tracker: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # https://github.com/Aniverse/inexistence 4 | # Author: Aniverse 5 | # 6 | ################################################################################# 7 | 8 | script_update=2020.08.19 9 | script_version=r22007 10 | 11 | ################################################################################# 12 | 13 | usage_guide() { 14 | s=/usr/bin/local/deluge-update-tracker 15 | s=$iHome/.config/deluge/script/deluge-update-tracker ; mkdir -p $iHome/.config/deluge/script 16 | rm -f $s ; nano $s ; chmod 755 $s 17 | # enable execute plugin, reboot deluged, use /root/deluge-update-tracker as path (/usr/bin/deluge-update-tracker or deluge-update-tracker is not executeable emmmm) 18 | } 19 | 20 | ################################################################################# 21 | 22 | torrentid=$1 23 | torrentname=$2 24 | torrentpath=$3 25 | 26 | ################################################################################# 27 | 28 | black='\033[0;30m' ; red='\033[0;31m' ; green='\033[0;32m' ; yellow='\033[0;33m' ; bold='\033[1m' 29 | blue='\033[0;34m' ; magenta='\033[0;35m' ; cyan='\033[0;36m' ; white='\033[0;37m' ; normal='\033[0m' 30 | 31 | ################################################################################# 32 | 33 | find /usr/lib/python*/dist-packages/deluge*/deluge/ui/console/commands -type f -printf "%f\n" | 34 | sort -d | grep update-tracker -q && 35 | update_tracker=1 36 | 37 | local=127.0.0.1 38 | log=/log/script/deluge-update-tracker.log 39 | [[ ! -f $log ]] && { mkdir -p $(dirname $log) ; touch $log ; } 40 | 41 | if [[ $EUID == 0 ]]; then 42 | source /etc/inexistence/00.Installation/function 43 | export_inexistence_info 44 | chown $iUser: $log 45 | if [[ $update_tracker != 1 ]]; then 46 | deluge_cmd_path=$(dirname $(find /usr/lib/python*/dist-packages/deluge*/deluge/ui/console/commands -type f | head -1)) 47 | cd $deluge_cmd_path 48 | wget https://github.com/Aniverse/inexistence-files/raw/master/miscellaneous/update-tracker.py -O update-tracker.py 49 | chmod 644 update-tracker.py 50 | fi 51 | else 52 | iHome="$HOME" 53 | fi 54 | 55 | # ddport=58846 56 | ddport=$(grep '"daemon_port": [0-9]*' $iHome/.config/deluge/core.conf | grep -oE "[0-9]+") 57 | [[ -z $ddport ]] && { echo "ERROR: No daemon port detected!" >> $log ; exit 1 ; } 58 | [[ -z $(which deluge-console) ]] && { echo "ERROR: No deluge-console detected!" >> $log ; exit 1 ; } 59 | 60 | connect_detail="connect $local:$ddport $iUser $iPass" 61 | connect_detail="connect $local:$ddport" 62 | 63 | ################################################################################# 64 | 65 | function update_tracker(){ 66 | if [[ $update_tracker == 1 ]]; then 67 | deluge-console "$connect_detail; update-tracker '$torrentid'" 68 | else 69 | deluge-console "$connect_detail; pause '$torrentid'" 70 | sleep 2 71 | deluge-console "$connect_detail; resume '$torrentid'" 72 | fi 73 | } 74 | 75 | function main(){ 76 | x=1 77 | while [ $x -le 65 ]; do 78 | sleep 2 79 | echo -e "$(date "+%Y.%m.%d %H:%M:%S") [$x]\t$torrentname" >> $log 80 | line=$(deluge-console "connect $local:$ddport; info" $1 2>&1 | grep "Tracker status") 81 | echo "$line" >> $log 82 | case "$line" in 83 | *Unregistered*|*unregistered*|*Sent*|*End*of*file*|*Bad*Gateway*|*Error*|*error*|*timed*out|*502*|*种子不存在于本服务器上*) 84 | update_tracker ;; 85 | *) 86 | echo -e "${green}[Good] $torrentname${normal}\n" >> $log ; 87 | break ;; 88 | esac 89 | x=$(( $x + 1 )) 90 | done 91 | } 92 | 93 | 94 | if [[ -z $torrentid ]]; then 95 | sleep 0 96 | elif [[ $torrentid == "-l" ]]; then 97 | printf "%-70s\n" "-" | sed 's/\s/-/g' 98 | tail -300 $log 99 | printf "%-70s\n" "-" | sed 's/\s/-/g' 100 | elif [[ $torrentid == "-c" ]]; then 101 | echo -n > $log 102 | echo "Log clean" 103 | else 104 | main 105 | fi 106 | 107 | ################################################################################# 108 | ################################################################################# 109 | ################################################################################# 110 | ################################################################################# 111 | ################################################################################# 112 | 113 | unused_codes_ignore_these() { 114 | # echo "[Info] TorrentID: $torrentid" >> $log 115 | # echo "${blue}[Info] TorrentName: $torrentname${normal}" >> $log 116 | Usernamee=ANUSER 117 | Passwordd=ANPASS 118 | line=$(/usr/bin/deluge-console "connect 127.0.0.1:$ddport $Usernamee $Passwordd; info" $1 | grep "Tracker status") 119 | echo $line >> $log 120 | case "$line" in 121 | *unregistered*|*Sent*|*End*of*file*|*Bad*Gateway*) eval /usr/bin/deluge-console "connect 127.0.0.1:$ddport $Usernamee $Passwordd\; update-tracker '$torrentid'";; 122 | *) echo "Found working torrent: $torrentname $torrentpath $torrentid" >> ~/script.log ; exit 1 ;; 123 | esac 124 | } 125 | -------------------------------------------------------------------------------- /00.Installation/hezi: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # https://github.com/Aniverse/inexistence 4 | # Author: Aniverse 5 | 6 | script_update=2020.07.15 7 | script_version=r11019 8 | script_name=hezi 9 | 10 | ################################################################################################ Debug 11 | 12 | usage_for_debug() { 13 | bash <(wget -qO- https://github.com/Aniverse/inexistence/raw/master/00.Installation/hezi) 14 | s=/etc/inexistence/00.Installation/hezi;rm -f $s ; nano $s ; chmod 755 $s 15 | } 16 | 17 | ################################################################################################ Set Variables 1 18 | 19 | if [[ -d /etc/inexistence/00.Installation ]]; then 20 | source /etc/inexistence/00.Installation/function 21 | source /etc/inexistence/00.Installation/ask 22 | source /etc/inexistence/00.Installation/options 23 | else 24 | source <(wget -qO- https://github.com/Aniverse/inexistence/raw/master/00.Installation/function) 25 | source <(wget -qO- https://github.com/Aniverse/inexistence/raw/master/00.Installation/ask) 26 | source <(wget -qO- https://github.com/Aniverse/inexistence/raw/master/00.Installation/options) 27 | fi 28 | 29 | ################################################################################################ Set Variables 2 30 | 31 | export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:$PATH 32 | export TZ=/usr/share/zoneinfo/Asia/Shanghai 33 | export DEBIAN_FRONTEND=noninteractive 34 | export APT_LISTCHANGES_FRONTEND=none 35 | export local_packages=/etc/inexistence/00.Installation 36 | export local_script=/usr/local/bin/abox 37 | 38 | export iBranch=master 39 | export times=0 40 | export LogBase=/log/inexistence 41 | export LogTimes=$LogBase/$times 42 | export SCLocation=$LogTimes/source 43 | export DebLocation=$LogTimes/deb 44 | export LogLocation=$LogTimes/log 45 | export LOCKLocation=$LogBase/.lock 46 | export WebROOT=/var/www 47 | 48 | export MAXCPUS=$(nproc) 49 | export script_lang=chs 50 | export_inexistence_info 51 | 52 | ################################################################################################ 53 | 54 | function show_usage () { 55 | echo -e "${bold}${yellow}hezi $script_version ($script_update)${normal} 56 | 这是一个用于管理盒子的脚本,目前支持的用法有: 57 | hezi buchong = 盒子补充 —————— 补充安装软件 58 | hezi gengxin = 盒子更新 —————— 更新脚本到最新版(尚未完善)" 59 | } 60 | 61 | function possible_usage () { 62 | hezi anzhuang rclone wine mono --de 1.3.15 --qb 4.2.5 --rt 0.9.8 # 批量安装软件 63 | hezi anzhuang deluge 1.3.15 # 安装 Deluge 1.3.15,同时会为所有 inexistence 脚本创建的用户创建配置文件和开机自启等 64 | hezi xiezai deluge # 卸载 Deluge,也会清除所有配置文件 65 | hezi adduser someone # 同时也会配置已安装的软件 66 | hezi deluser someone # 清空 home 目录,删除所有配置,关闭所有相关进程 67 | hezi mima someone 12345678 # 把用户 someone 的所有密码(SSH/软件 webui 密码/RPC 密码)修改成 12345678 68 | hezi rizhi # 出现日志菜单,让用户选择查看哪个软件的日志 69 | hezi # 直接输入 hezi,出现菜单,让用户选择做什么(可以考虑用 whiptail) 70 | } 71 | 72 | ################################################################################################ 73 | 74 | ACTION=$1 75 | 76 | function ask_if_install () { 77 | script_cmd="hezi buchong" 78 | arg=("$@") 79 | ExtraArgs=("${arg[@]:1}") 80 | OPTS=$(getopt -o dsyu:p:b:h --long "qb-source,help,hostname:,domain:,no-reboot,quick,branch:,yes,skip,no-system-upgrade,debug,no-source-change,swap,no-swap,bbr,no-bbr,flood,vnc,x2go,wine,mono,tools,filebrowser,no-filebrowser,flexget,no-flexget,rclone,enable-ipv6,tweaks,no-tweaks,mt-single,mt-double,mt-all,mt-half,tr-deb,eng,chs,sihuo,user:,password:,webpass:,de:,qb:,rt:,tr:,lt:,qb-static,separate" -- "${ExtraArgs[@]}") 81 | [ ! $? = 0 ] && show_inex_usage 82 | eval set -- "$OPTS" 83 | opts_action "${ExtraArgs[@]}" 84 | 85 | set_language 86 | check_install_2 87 | get_clients_version 88 | mkdir -p $LogBase/$times 89 | 90 | if [[ -z $iPass ]]; then 91 | create_user=1 92 | ask_username 93 | ask_password 94 | fi 95 | 96 | # password needed 97 | ask_qbittorrent 98 | ask_deluge 99 | ask_transmission 100 | ask_rtorrent 101 | ask_flexget 102 | ask_filebrowser 103 | ask_rdp 104 | # password not needed 105 | ask_wine 106 | ask_mono 107 | ask_rclone 108 | ask_tools 109 | 110 | if_need_lt=0 111 | [[ $qb_version != No ]] && [[ -z $qb_mode ]] && if_need_lt=1 112 | [[ $de_version != No ]] && if_need_lt=1 113 | [[ $if_need_lt == 1 ]] && [[ -z $lt_version ]] && lt_version=RC_1_1 114 | 115 | if [[ $create_user == 1 ]]; then 116 | hezi_add_user $iUser $iPass 117 | fi 118 | } 119 | 120 | function update_inexistence () { 121 | echo -e "${bold}更新中 ... ${normal}" 122 | cd /etc/inexistence 123 | git reset --hard origin/master 124 | git pull 125 | # wget -q https://github.com/Aniverse/inexistence/raw/master/00.Installation/alias -O /etc/inexistence/00.Installation/alias 126 | # wget -q https://github.com/Aniverse/inexistence/raw/master/00.Installation/function -O /etc/inexistence/00.Installation/function 127 | sed -i "s/iUser/$iUser/g" $local_packages/s-alias 128 | chmod 755 -R $local_packages 129 | chmod 644 /usr/local/bin/s-alias 130 | echo -e "${bold}大概更新完了${normal}" 131 | } 132 | 133 | ################################################################################################ 134 | 135 | case $ACTION in 136 | buchong ) ask_if_install "$@" ; do_installation ;; 137 | gengxin ) update_inexistence ;; 138 | * ) show_usage ;; 139 | esac 140 | -------------------------------------------------------------------------------- /00.Installation/package/wine/install: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # https://github.com/Aniverse/inexistence 4 | # Author: Aniverse 5 | 6 | script_update=2020.03.05 7 | script_version=r10006 8 | 9 | ################################################################################################ Debug 10 | 11 | usage_for_debug() { 12 | export local_packages=/etc/inexistence/00.Installation 13 | export s=$local_packages/package/wine/install 14 | rm -f $s ; nano $s ; bash $s 15 | bash <(wget -qO- https://github.com/Aniverse/inexistence/raw/master/00.Installation/package/wine/install) 16 | } 17 | 18 | ################################################################################################ Get options 19 | 20 | unset AppName AppNameLower Need_SourceCode pm_action \ 21 | LogRootPath LogTimes DebLocation SCLocation LOCKLocation OutputLOG 22 | 23 | AppName=wine 24 | AppNameLower=wine 25 | Need_SourceCode=no 26 | pm_action=install 27 | 28 | function show_usage() { echo " 29 | $AppName $pm_action $script_version ($script_update) 30 | Usage: 31 | -l Specifiy LogBase 32 | -d Enable debug mode 33 | --log Show logfile's content" 34 | exit 1 ; } 35 | 36 | OPTS=$(getopt -o v:l:d -al version:,debug,logbase:,log -- "$@") 37 | [ ! $? = 0 ] && show_usage 38 | eval set -- "$OPTS" 39 | 40 | while [ -n "$1" ] ; do case "$1" in 41 | -v | --version ) version="$2" ; shift 2 ;; 42 | -l | --logbase ) LogTimes="$2" ; shift 2 ;; 43 | -d | --debug ) debug=1 ; shift ;; 44 | --log ) show_log=1 ; shift ;; 45 | -- ) shift ; break ;; 46 | esac ; done 47 | 48 | ################################################################################################ Set Variables 49 | 50 | if [[ -f /etc/inexistence/00.Installation/function ]]; then 51 | source /etc/inexistence/00.Installation/function 52 | else 53 | source <(wget -qO- https://github.com/Aniverse/inexistence/raw/master/00.Installation/function) 54 | fi 55 | 56 | set_variables_log_location 57 | check_var_OutputLOG 58 | debug_log_location 59 | cat_outputlog 60 | 61 | ################################################################################################ 62 | 63 | 64 | 65 | 66 | 67 | # https://wiki.winehq.org/Debian 68 | # https://wiki.winehq.org/Ubuntu 69 | 70 | function install_wine() { 71 | 72 | echo >> $OutputLOG 73 | 74 | dpkg --add-architecture i386 >> $OutputLOG 2>&1 75 | # wget -O- https://dl.winehq.org/wine-builds/Release.key | apt-key add - >> $OutputLOG 76 | # apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 76F1A20FF987672F >> $OutputLOG 77 | wget -nv https://dl.winehq.org/wine-builds/winehq.key -O /tmp/winehq.key >> $OutputLOG 2>&1 78 | apt-key add /tmp/winehq.key >> $OutputLOG 2>&1 79 | rm -f /tmp/winehq.key 80 | 81 | # if [[ $DISTRO == Ubuntu ]]; then 82 | # apt-add-repository -y https://dl.winehq.org/wine-builds/ubuntu/ >> $OutputLOG 2>&1 83 | # elif [[ $DISTRO == Debian ]]; then 84 | [[ $CODENAME != focal ]] && 85 | echo "deb https://dl.winehq.org/wine-builds/$DISTROL/ $CODENAME main" > /etc/apt/sources.list.d/wine.list 86 | # fi 87 | 88 | # https://forum.winehq.org/viewtopic.php?f=8&t=32192 89 | # Fix missing FAudio on Debian 10 and Ubuntu 18.04 90 | if [[ $CODENAME == buster ]]; then 91 | #mkdir -p /tmp/wine && cd /tmp/wine 92 | #wget -nv https://download.opensuse.org/repositories/Emulators:/Wine:/Debian/xUbuntu_18.04/amd64/libfaudio0-dbgsym_19.07-0~bionic_amd64.ddeb >> $OutputLOG 2>&1 93 | #wget -nv https://download.opensuse.org/repositories/Emulators:/Wine:/Debian/xUbuntu_18.04/amd64/libfaudio0_19.07-0~bionic_amd64.deb >> $OutputLOG 2>&1 94 | #apt-get install -y ./libfaudio0-dbgsym_19.07-0~bionic_amd64.ddeb ./libfaudio0_19.07-0~bionic_amd64.deb >> $OutputLOG 2>&1 95 | #cd && rm -rf /tmp/wine 96 | wget -nv https://download.opensuse.org/repositories/Emulators:/Wine:/Debian/Debian_10/Release.key -O /tmp/opensuse.key >> $OutputLOG 2>&1 97 | apt-key add /tmp/opensuse.key >> $OutputLOG 2>&1 98 | rm -f /tmp/opensuse.key 99 | echo "deb https://download.opensuse.org/repositories/Emulators:/Wine:/Debian/Debian_10 ./" > /etc/apt/sources.list.d/opensuse.wine.list 100 | elif [[ $CODENAME == bionic ]]; then 101 | #mkdir -p /tmp/wine && cd /tmp/wine 102 | #wget -nv https://download.opensuse.org/repositories/Emulators:/Wine:/Debian/Debian_10/amd64/libfaudio0-dbgsym_20.01-0~buster_amd64.deb >> $OutputLOG 2>&1 103 | #wget -nv https://download.opensuse.org/repositories/Emulators:/Wine:/Debian/xUbuntu_18.04/amd64/libfaudio0_19.07-0~bionic_amd64.deb >> $OutputLOG 2>&1 104 | #apt-get install -y ./*.deb >> $OutputLOG 2>&1 105 | #cd && rm -rf /tmp/wine 106 | wget -nv https://download.opensuse.org/repositories/Emulators:/Wine:/Debian/xUbuntu_18.04/Release.key -O /tmp/opensuse.key >> $OutputLOG 2>&1 107 | apt-key add /tmp/opensuse.key >> $OutputLOG 2>&1 108 | rm -f /tmp/opensuse.key 109 | echo "deb https://download.opensuse.org/repositories/Emulators:/Wine:/Debian/xUbuntu_18.04/ ./" > /etc/apt/sources.list.d/opensuse.wine.list 110 | fi 111 | 112 | APT_UPGRADE 113 | apt_install_check winehq-stable 114 | apt_install_separate # && touch /tmp/$status_lock.1.lock || touch /tmp/$status_lock.2.lock # --install-recommends 115 | 116 | wget -nv -N https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks -O /usr/local/bin/winetricks >> $OutputLOG 2>&1 117 | chmod 755 /usr/local/bin/winetricks >> $OutputLOG 2>&1 118 | 119 | status_lock=$AppNameLower 120 | echo "status_lock=$status_lock" > /tmp/Variables 121 | rm -f /tmp/$status_lock.1.lock /tmp/$status_lock.2.lock 122 | which wine > /dev/null && touch /tmp/$status_lock.1.lock || touch /tmp/$status_lock.2.lock 123 | [[ -f /tmp/$status_lock.1.lock ]] && touch $LOCKLocation/$AppNameLower.lock 124 | echo >> $OutputLOG 125 | 126 | } 127 | 128 | 129 | 130 | 131 | 132 | echo_task "Installing $AppName ..." 133 | install_wine & spinner $! 134 | check_status $status_lock 135 | -------------------------------------------------------------------------------- /00.Installation/package/vnstat/install: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # https://github.com/Aniverse/inexistence 4 | # Author: Aniverse 5 | 6 | script_update=2020.04.19 7 | script_version=r10004 8 | 9 | ################################################################################################ Debug 10 | 11 | usage_for_debug() { 12 | export local_packages=/etc/inexistence/00.Installation 13 | export s=$local_packages/package/vnstat/install 14 | rm -f $s ; nano $s ; bash $s 15 | bash <(wget -qO- https://github.com/Aniverse/inexistence/raw/master/00.Installation/package/vnstat/install) 16 | } 17 | 18 | ################################################################################################ Get options 19 | 20 | unset LogRootPath LogTimes DebLocation SCLocation LOCKLocation OutputLOG 21 | 22 | AppName=vnstat 23 | AppNameLower=vnstat 24 | Need_SourceCode=yes 25 | pm_action=install 26 | 27 | function show_usage() { echo " 28 | $AppName $pm_action $script_version ($script_update) 29 | Usage: 30 | -l Specifiy LogBase (Not log file) 31 | -i Specifiy Default interface monitored by vnstat 32 | -d Enable debug mode 33 | --log Show logfile's content" 34 | exit 1 ; } 35 | 36 | OPTS=$(getopt -o v:l:i:d -al version:,debug,logbase:,interface:,log -- "$@") 37 | [ ! $? = 0 ] && show_usage 38 | eval set -- "$OPTS" 39 | 40 | while [ -n "$1" ] ; do case "$1" in 41 | -v | --version ) version="$2" ; shift 2 ;; 42 | -l | --logbase ) LogTimes="$2" ; shift 2 ;; 43 | -i | --interface ) wangka="$2" ; shift 2 ;; 44 | -d | --debug ) debug=1 ; shift ;; 45 | --log ) show_log=1 ; shift ;; 46 | -- ) shift ; break ;; 47 | esac ; done 48 | 49 | ################################################################################################ Set Variables 50 | 51 | if [[ -f /etc/inexistence/00.Installation/function ]]; then 52 | source /etc/inexistence/00.Installation/function 53 | else 54 | source <(wget -qO- https://github.com/Aniverse/inexistence/raw/master/00.Installation/function) 55 | fi 56 | 57 | set_variables_log_location 58 | check_var_OutputLOG 59 | debug_log_location 60 | cat_outputlog 61 | 62 | [ -n "$(grep 'eth0:' /proc/net/dev)" ] && wangka1=eth0 || wangka1=`cat /proc/net/dev |awk -F: 'function trim(str){sub(/^[ \t]*/,"",str); sub(/[ \t]*$/,"",str); return str } NR>2 {print trim($1)}' |grep -Ev '^lo|^sit|^stf|^gif|^dummy|^vmnet|^vir|^gre|^ipip|^ppp|^bond|^tun|^tap|^ip6gre|^ip6tnl|^teql|^venet|^he-ipv6|^docker' |awk 'NR==1 {print $0}'` 63 | wangka2=$(ip link show | grep -i broadcast | grep -m1 UP | cut -d: -f 2 | cut -d@ -f 1 | sed 's/ //g') 64 | 65 | if [[ -n $wangka2 ]]; then 66 | if [[ $wangka1 == $wangka2 ]];then 67 | interface=$wangka1 68 | else 69 | interface=$wangka2 70 | fi 71 | else 72 | interface=$wangka1 73 | fi 74 | 75 | [[ -n $wangka ]] && interface=$wangka 76 | 77 | ################################################################################################ 78 | 79 | 80 | 81 | 82 | 83 | # https://humdi.net/wiki/vnstat/install/in_debian 84 | # https://github.com/vergoh/vnstat 85 | # https://github.com/alexandermarston/vnstat-dashboard 86 | 87 | function install_vnstat() { 88 | echo >> $OutputLOG 89 | 90 | apt_install_check make gcc libc6-dev libsqlite3-0 libsqlite3-dev composer 91 | apt_install_separate # && touch /tmp/$status_lock.1.lock || touch /tmp/$status_lock.2.lock 92 | 93 | # wget -nv -N https://github.com/vergoh/vnstat/releases/download/v2.6/vnstat-2.6.tar.gz 94 | wget -nv -N https://humdi.net/vnstat/vnstat-latest.tar.gz >> "$OutputLOG" 2>&1 95 | tar zxf vnstat-latest.tar.gz >> "$OutputLOG" 2>&1 96 | rm -f vnstat-latest.tar.gz >> "$OutputLOG" 2>&1 97 | cd vnstat-* >> "$OutputLOG" 2>&1 98 | ./configure --prefix=/usr --sysconfdir=/etc >> "$OutputLOG" 2>&1 99 | make -j$MAXCPUS >> "$OutputLOG" 2>&1 100 | make install >> "$OutputLOG" 2>&1 101 | 102 | if systemctl status vnstatz 2>&1 | grep -q "not.*found" ; then 103 | cp -f examples/systemd/simple/vnstat.service /etc/systemd/system/ 104 | fi 105 | 106 | [[ -f /etc/systemd/system/vnstat.service ]] && sed -i -e '/^ProtectSystem=/d' /etc/systemd/system/vnstat.service 107 | [[ -n $interface ]] && [[ $interface != eth0 ]] && sed -i "s/Interface.*/Interface $interface/" /etc/vnstat.conf 108 | 109 | systemctl daemon-reload >> "$OutputLOG" 2>&1 110 | systemctl enable vnstatd >> "$OutputLOG" 2>&1 111 | systemctl restart vnstatd >> "$OutputLOG" 2>&1 112 | cd .. 113 | rm -rf vnstat-* 114 | 115 | if [[ -d $web_rutorrent ]] && [[ -n $(which composer) ]] ; then 116 | git clone --depth=1 https://github.com/alexandermarston/vnstat-dashboard >> "$OutputLOG" 2>&1 117 | cp -rp vnstat-dashboard/app/ $web_root/vnstat/ >> "$OutputLOG" 2>&1 118 | rm -rf vnstat-dashboard >> "$OutputLOG" 2>&1 119 | cd $web_root/vnstat/ >> "$OutputLOG" 2>&1 120 | composer install >> "$OutputLOG" 2>&1 121 | chown -R www-data:www-data $web_root/vnstat >> "$OutputLOG" 2>&1 122 | fi 123 | 124 | vnstat_ver=$(vnstat --version | grep -oE "[0-9.]+") 125 | 126 | status_lock=$AppNameLower 127 | echo "status_lock=$status_lock" > /tmp/Variables 128 | rm -f /tmp/$status_lock.1.lock /tmp/$status_lock.2.lock 129 | if version_ge $vnstat_ver 2.6; then 130 | touch /tmp/$status_lock.1.lock 131 | else 132 | touch /tmp/$status_lock.2.lock 133 | fi 134 | [[ -f /tmp/$status_lock.1.lock ]] && touch $LOCKLocation/$AppNameLower.lock 135 | 136 | if wget --no-check-certificate "https://127.0.0.1/vnstat" -o /dev/null -qO- 2>&1 | grep Traffic -q ; then 137 | touch $LOCKLocation/vnstat.dashboard.lock 138 | fi 139 | 140 | echo >> $OutputLOG 141 | } 142 | 143 | 144 | 145 | 146 | 147 | echo_task "Installing $AppName ..." 148 | install_vnstat & spinner $! 149 | check_status $status_lock 150 | -------------------------------------------------------------------------------- /00.Installation/package/pyenv: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # https://github.com/Aniverse/inexistence 4 | # Author: Aniverse 5 | 6 | script_update=2020.06.29 7 | script_version=r20003 8 | 9 | ################################################################################################ Debug 10 | 11 | usage_for_debug() { 12 | 13 | if [[ -f /etc/inexistence/00.Installation/package/pyenv ]]; then 14 | bash /etc/inexistence/00.Installation/package/pyenv 15 | else 16 | bash <(wget -qO- https://github.com/Aniverse/inexistence/raw/master/00.Installation/package/pyenv) 17 | fi 18 | 19 | } 20 | 21 | ################################################################################################ 22 | 23 | unset LogRootPath LogTimes DebLocation SCLocation LOCKLocation OutputLOG 24 | 25 | AppName=pyenv 26 | AppNameLower=pyenv 27 | AppExec=pyenv 28 | AppTest="$AppExec -h" 29 | Need_SourceCode=no 30 | # pm_action=install 31 | 32 | function show_usage() { echo " 33 | $AppName $pm_action $script_version ($script_update) 34 | Usage: 35 | -l Specifiy LogBase (Not log file) 36 | -d Enable debug mode 37 | --log Show logfile's content" 38 | exit 1 ; } 39 | 40 | OPTS=$(getopt -o v:l:d -al version:,debug,logbase:,log,tmp -- "$@") 41 | [ ! $? = 0 ] && show_usage 42 | eval set -- "$OPTS" 43 | 44 | while [ -n "$1" ] ; do case "$1" in 45 | -v | --version ) version="$2" ; shift 2 ;; 46 | -l | --logbase ) LogTimes="$2" ; shift 2 ;; 47 | -d | --debug ) debug=1 ; shift ;; 48 | --log ) show_log=1 ; shift ;; 49 | --tmp ) tmp=1 ; shift ;; 50 | -- ) shift ; break ;; 51 | esac ; done 52 | 53 | ################################################################################################ Set Variables 54 | 55 | if [[ -f /etc/inexistence/00.Installation/function ]]; then 56 | source /etc/inexistence/00.Installation/function 57 | else 58 | source <(wget -qO- https://github.com/Aniverse/inexistence/raw/master/00.Installation/function) 59 | fi 60 | 61 | set_variables_log_location 62 | check_var_OutputLOG 63 | debug_log_location 64 | cat_outputlog 65 | 66 | ################################################################################################ 67 | 68 | 69 | # https://github.com/liaralabs/swizzin/blob/master/sources/functions/pyenv 70 | # https://raw.githubusercontent.com/pyenv/pyenv-installer/master/bin/pyenv-installer 71 | function install_pyenv () { 72 | cat << EOF > /root/.bash_pyenv 73 | # pyenv 74 | export PYENV_ROOT="/opt/pyenv" 75 | export PATH="/opt/pyenv/bin:\$PATH" 76 | eval "\$(pyenv init -)" 77 | eval "\$(pyenv virtualenv-init -)" 78 | EOF 79 | source /root/.bash_pyenv >> "$OutputLOG" 2>&1 80 | 81 | APT_UPGRADE_check 82 | apt_install_check wget curl llvm git build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev \ 83 | libncurses5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev liblzma-dev \ 84 | python-openssl libncursesw5-dev 85 | apt_install_together 86 | 87 | # PYENV_ROOT=/opt/pyenv bash <(wget -qO- https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer -o /dev/null) >> "$OutputLOG" 2>&1 88 | git clone --depth=1 https://github.com/pyenv/pyenv.git /opt/pyenv >> "$OutputLOG" 2>&1 89 | git clone --depth=1 https://github.com/pyenv/pyenv-update.git /opt/pyenv/plugins/pyenv-update >> "$OutputLOG" 2>&1 90 | git clone --depth=1 https://github.com/pyenv/pyenv-doctor.git /opt/pyenv/plugins/pyenv-doctor >> "$OutputLOG" 2>&1 91 | git clone --depth=1 https://github.com/pyenv/pyenv-installer.git /opt/pyenv/plugins/pyenv-installer >> "$OutputLOG" 2>&1 92 | git clone --depth=1 https://github.com/pyenv/pyenv-which-ext.git /opt/pyenv/plugins/pyenv-which-ext >> "$OutputLOG" 2>&1 93 | git clone --depth=1 https://github.com/pyenv/pyenv-virtualenv.git /opt/pyenv/plugins/pyenv-virtualenv >> "$OutputLOG" 2>&1 94 | 95 | generate_status_lock 96 | } 97 | 98 | 99 | ################################################################################################ 100 | 101 | if [[ ! -f $LOCKLocation/pyenv.lock ]]; then 102 | echo_task "Installing pyenv ..." 103 | install_pyenv & spinner $! 104 | check_status $status_lock 105 | fi 106 | 107 | ################################################################################################ deprecated 108 | 109 | function install_python3 () { 110 | echo >> "$OutputLOG" 111 | APT_UPGRADE_check 112 | if [[ "$CODENAME" == "xenial" ]]; then 113 | apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 F23C5A6CF475977595C89F51BA6932366A755776 >> "$OutputLOG" 2>&1 114 | LC_ALL=en_US.UTF-8 add-apt-repository ppa:deadsnakes/ppa -y >> "$OutputLOG" 2>&1 115 | APT_UPGRADE 116 | apt_install_check python3.6 python3.6-gdbm 117 | apt_install_separate 118 | update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.5 1 >> "$OutputLOG" 2>&1 119 | update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 2 >> "$OutputLOG" 2>&1 120 | elif [[ "$CODENAME" =~ (jessie|stretch) ]]; then 121 | apt_install_check build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev libsqlite3-dev 122 | apt_install_separate 123 | if [[ "$CODENAME" == jessie ]]; then 124 | apt-get -t jessie-backports -y install libssl1.0 >> "$OutputLOG" 2>&1 125 | if ! version_ge $(dpkg-query -W -f='${Version}' libssl-dev 2>&1 | grep -oE "[0-9].[0-9].[0-9]+" | head -1) 1.0.2 ; then 126 | echo_error "Failed to install libssl 1.0.2l" 127 | exit 1 128 | fi 129 | fi 130 | wget -nv -O Python-3.7.6.tar.xz https://www.python.org/ftp/python/3.7.6/Python-3.7.6.tar.xz >> "$OutputLOG" 2>&1 131 | tar -xf Python-3.7.6.tar.xz >> "$OutputLOG" 2>&1 132 | cd Python-3.7.6 >> "$OutputLOG" 2>&1 133 | ./configure >> "$OutputLOG" 2>&1 134 | make -j$(nproc) >> "$OutputLOG" 2>&1 135 | make install >> "$OutputLOG" 2>&1 136 | update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.4 1 >> "$OutputLOG" 2>&1 # Debian 8 jessie 137 | update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.5 1 >> "$OutputLOG" 2>&1 # Debian 9 stretch 138 | update-alternatives --install /usr/bin/python3 python3 /usr/local/bin/python3.7 2 >> "$OutputLOG" 2>&1 139 | cd .. >> "$OutputLOG" 2>&1 140 | rm -rf {Python-3.7.6.tar.xz,Python-3.7.6} 141 | if [[ ! -f /usr/local/lib/python3.7/site-packages/lsb_release.py ]]; then 142 | ln -s /usr/lib/python3/dist-packages/lsb_release.py /usr/local/lib/python3.7/site-packages/lsb_release.py >> "$OutputLOG" 2>&1 143 | fi 144 | else 145 | apt_install_check python3-pip python3-setuptools 146 | apt_install_separate 147 | fi 148 | 149 | python3_ver=$(python3 -V | grep -oE "[0-9.]+") 150 | 151 | status_lock=python3 152 | echo "status_lock=$status_lock" > /tmp/Variables 153 | rm -f /tmp/$status_lock.1.lock /tmp/$status_lock.2.lock 154 | if version_ge $python3_ver 3.6; then 155 | touch /tmp/$status_lock.1.lock 156 | else 157 | touch /tmp/$status_lock.2.lock 158 | fi 159 | [[ -f /tmp/$status_lock.1.lock ]] && touch $LOCKLocation/python3.lock 160 | echo >> $OutputLOG 161 | } 162 | -------------------------------------------------------------------------------- /00.Installation/script/ipv6.old: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # https://github.com/Aniverse/inexistence 3 | # 4 | # References 5 | # https://github.com/outime/ipv6-dhclient-script 6 | # https://github.com/jxzy199306/ipv6-dhclient-script 7 | 8 | black=$(tput setaf 0); red=$(tput setaf 1); green=$(tput setaf 2); yellow=$(tput setaf 3);blue=$(tput setaf 4); magenta=$(tput setaf 5); cyan=$(tput setaf 6); white=$(tput setaf 7);on_red=$(tput setab 1); on_green=$(tput setab 2); on_yellow=$(tput setab 3); on_blue=$(tput setab 4);on_magenta=$(tput setab 5); on_cyan=$(tput setab 6); on_white=$(tput setab 7); bold=$(tput bold);dim=$(tput dim); underline=$(tput smul); reset_underline=$(tput rmul); standout=$(tput smso);reset_standout=$(tput rmso); normal=$(tput sgr0); alert=${white}${on_red}; title=${standout};baihuangse=${white}${on_yellow}; bailanse=${white}${on_blue}; bailvse=${white}${on_green};baiqingse=${white}${on_cyan}; baihongse=${white}${on_red}; baizise=${white}${on_magenta};heibaise=${black}${on_white};shanshuo=$(tput blink); wuguangbiao=$(tput civis); guangbiao=$(tput cnorm);jiacu=${normal}${bold} 9 | 10 | LAST_UPDATE=2018.07.20 11 | 12 | BLOCK_ADDR=$1 13 | BLOCK_SUBNET=$2 14 | BLOCK_DUID=$3 15 | INTERFACE=$4 16 | [[ -z $INTERFACE ]] && INTERFACE=`ifconfig -a | grep -B 1 $(ip route get 8.8.8.8 | awk 'NR==1 {print $NF}') | head -n1 | awk '{print $1}' | sed "s/:$//"` 17 | DHCLIENT6_FILE="/etc/dhcp/dhclient6.conf" 18 | 19 | #[ -n "$(grep 'eth0:' /proc/net/dev)" ] && wangka=eth0 || wangka=`cat /proc/net/dev |awk -F: 'function trim(str){sub(/^[ \t]*/,"",str); sub(/[ \t]*$/,"",str); return str } NR>2 {print trim($1)}' |grep -Ev '^lo|^sit|^stf|^gif|^dummy|^vmnet|^vir|^gre|^ipip|^ppp|^bond|^tun|^tap|^ip6gre|^ip6tnl|^teql|^venet|^he-ipv6|^docker' |awk 'NR==1 {print $0}'` 20 | wangka=`ifconfig -a | grep -B 1 $(ip route get 8.8.8.8 | awk 'NR==1 {print $NF}') | head -n1 | awk '{print $1}' | sed "s/:$//"` 21 | 22 | if [[ "$(id -u)" != 0 ]]; then 23 | echo "${bold}${baihongse}ERROR${normal} ${bold}You need to run this script as root${normal}" 24 | exit 1 25 | fi 26 | 27 | if [[ -e /etc/debian_version ]]; then 28 | DISTRO="Debian" 29 | elif [[ -f /etc/redhat-release ]]; then 30 | DISTRO="Redhat" 31 | else 32 | echo "${bold}${baihongse}ERROR${normal} ${bold}This distribution is not supported${normal}" 33 | exit 1 34 | fi 35 | 36 | while : 37 | do 38 | clear 39 | if ! [[ -f /proc/net/if_inet6 ]]; then 40 | echo "${bold}${baihongse}ERROR${normal} ${bold}Seems that IPv6 is not supported by your kernel or the module is not loaded (is it blacklisted?)${normal}" 41 | exit 1 42 | fi 43 | 44 | [[ -a $DHCLIENT6_FILE ]] && echo "${bold}${red}Attention${jiacu} dhclient6.conf detected. Existing config will be replaced" 45 | echo "${bold}${red}WARNING${jiacu} Network will restart at the end of this script so any existing connections will be dropped!${normal}" 46 | echo 47 | 48 | while [[ $INTERFACE = "" ]]; do 49 | read -e -p "${bold}${yellow}Interface where IPv6 will be enabled: ${blue}" -i $wangka INTERFACE 50 | echo -ne "${normal}" 51 | done 52 | 53 | echo 54 | 55 | CURRENT_IPV6=$(ip addr show dev $INTERFACE | sed -e's/^.*inet6 \([^ ]*\)\/.*$/\1/;t;d') 56 | if [[ $? -eq 0 ]]; then 57 | echo "${bold}You have the following IPv6 addreses configured for ${blue}$INTERFACE${jiacu}" 58 | echo "${green}${CURRENT_IPV6}${jiacu}" 59 | read -e -p "Continue? [Y/n]: ${normal}" -i "Y" SKIP 60 | if ! [[ $SKIP =~ ^([yY][eE][sS]|[yY])$ ]]; then 61 | exit 1 62 | fi 63 | fi 64 | 65 | echo 66 | 67 | while [[ $BLOCK_ADDR = "" ]]; do # to be replaced with regex 68 | read -p "${bold}${yellow}Input your IPv6 block address ${jiacu}(e.g. ${underline}2001:bb8:3e23:200::${reset_underline}): ${blue}" BLOCK_ADDR 69 | done 70 | 71 | while ! [[ $BLOCK_SUBNET =~ ^[0-9]+$ ]]; do 72 | read -p "${bold}${yellow}Input your subnet for block ${jiacu}(e.g. if it's /56, input ${underline}56${reset_underline}): ${blue}" BLOCK_SUBNET 73 | done 74 | 75 | while [[ $BLOCK_DUID = "" ]]; do # to be replaced with regex 76 | read -p "${bold}${yellow}Input your associated DUID ${jiacu}(e.g. ${underline}00:03:00:00:34:b0:0c:47:4a:0e${reset_underline}): ${blue}" BLOCK_DUID 77 | echo -ne "${normal}" 78 | done 79 | 80 | echo; echo "${bold}Press ${on_green}ENTER${normal} ${bold}to start${normal}" ;read answer 81 | 82 | echo;echo "${bold}Working...${normal}";echo 83 | 84 | if [[ $DISTRO = "Debian" ]]; then 85 | INTERFACES_FILE="/etc/network/interfaces" 86 | [[ `tail -n1 $INTERFACES_FILE | grep IPv6_Script` ]] && sed -i -n -e :a -e '1,8!{P;N;D;};N;ba' $INTERFACES_FILE 87 | echo "" >> $INTERFACES_FILE 88 | echo "### Added by IPv6_Script ###" >> $INTERFACES_FILE 89 | echo "iface $INTERFACE inet6 static" >> $INTERFACES_FILE 90 | echo "address $BLOCK_ADDR" >> $INTERFACES_FILE 91 | echo "netmask $BLOCK_SUBNET" >> $INTERFACES_FILE 92 | echo "accept_ra 1" >> $INTERFACES_FILE 93 | echo "pre-up dhclient -cf /etc/dhcp/dhclient6.conf -pf /run/dhclient6.$INTERFACE.pid -6 -P $INTERFACE" >> $INTERFACES_FILE 94 | echo "pre-down dhclient -x -pf /run/dhclient6.$INTERFACE.pid" >> $INTERFACES_FILE 95 | echo "### IPv6_Script END ###" >> $INTERFACES_FILE 96 | elif [[ $DISTRO = "Redhat" ]]; then 97 | INTERFACES_FILE="/etc/systemd/system/ipv6-dhclient.service" 98 | rm -rf $INTERFACES_FILE 99 | echo "[Unit]" >> $INTERFACES_FILE 100 | echo "Description=$INTERFACE IPv6" >> $INTERFACES_FILE 101 | echo "After=network.target" >> $INTERFACES_FILE 102 | echo "" >> $INTERFACES_FILE 103 | echo "[Service]" >> $INTERFACES_FILE 104 | echo "Type=oneshot" >> $INTERFACES_FILE 105 | echo "RemainAfterExit=yes" >> $INTERFACES_FILE 106 | echo "ExecStart=/usr/sbin/dhclient -cf /etc/dhcp/dhclient6.conf -pf /run/dhclient6.$INTERFACE.pid -6 -P $INTERFACE" >> $INTERFACES_FILE 107 | echo "ExecStart=/usr/sbin/ifconfig $INTERFACE inet6 add $BLOCK_ADDR/$BLOCK_SUBNET" >> $INTERFACES_FILE 108 | echo "" >> $INTERFACES_FILE 109 | echo "ExecStop=/usr/bin/killall dhclient" >> $INTERFACES_FILE 110 | echo "ExecStop=/usr/sbin/ifconfig $INTERFACE inet6 del $BLOCK_ADDR/$BLOCK_SUBNET" >> $INTERFACES_FILE 111 | echo "" >> $INTERFACES_FILE 112 | echo "[Install]" >> $INTERFACES_FILE 113 | echo "WantedBy=multi-user.target" >> $INTERFACES_FILE 114 | fi 115 | 116 | rm -rf $DHCLIENT6_FILE 117 | echo "interface \"$INTERFACE\" {" >> $DHCLIENT6_FILE 118 | echo "send dhcp6.client-id $BLOCK_DUID;" >> $DHCLIENT6_FILE 119 | echo "request;" >> $DHCLIENT6_FILE 120 | echo "}" >> $DHCLIENT6_FILE 121 | 122 | if [[ $DISTRO = "Debian" ]]; then 123 | sysctl -w net.ipv6.conf.$INTERFACE.autoconf=0 > /dev/null 124 | sed -i '/^net.ipv6.conf.*/'d /etc/sysctl.conf 125 | echo "net.ipv6.conf.$INTERFACE.autoconf=0" >> /etc/sysctl.conf 126 | 127 | # ifdown $INTERFACE && ifup $INTERFACE ; ifup $INTERFACE 128 | # 瞎改…… 129 | 130 | if [[ ! `command -v ifdown` ]]; then 131 | apt-get install -y ifupdown 132 | ifdown $INTERFACE && ifup $INTERFACE ; ifup $INTERFACE ; ifup $INTERFACE 133 | # systemctl restart networking.service 134 | elif [[ ! `command -v systemctl` ]]; then 135 | ifdown $INTERFACE && ifup $INTERFACE ; ifup $INTERFACE ; ifup $INTERFACE 136 | else 137 | ifdown $INTERFACE && ifup $INTERFACE ; ifup $INTERFACE ; ifup $INTERFACE 138 | systemctl restart networking.service 139 | fi 140 | 141 | elif [[ $DISTRO = "Redhat" ]]; then 142 | systemctl enable ipv6-dhclient 143 | systemctl restart ipv6-dhclient 144 | fi 145 | 146 | echo; echo "${bold}${green}Testing IPv6 connectivity...${normal}"; echo 147 | IPV6_TEST=$(ping6 -c 5 ipv6.google.com | grep 'received' | awk -F',' '{ print $2 }' | awk '{ print $1 }') 148 | if [[ $IPV6_TEST > 0 ]]; then 149 | echo "${bold}${green}Success!${normal}" 150 | exit 0 151 | else 152 | echo "${bold}${red}Something went wrong :(${normal}" 153 | exit 1 154 | fi 155 | done 156 | 157 | -------------------------------------------------------------------------------- /00.Installation/package/transmission/install: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # https://github.com/Aniverse/inexistence 4 | # Author: Aniverse 5 | 6 | script_update=2020.07.07 7 | script_version=r10005 8 | 9 | ################################################################################################ Debug 10 | 11 | usage_for_debug() { 12 | s=12345 ; rm -f $s ; nano $s ; bash $s 13 | bash <(wget -qO- https://github.com/Aniverse/inexistence/raw/master/00.Installation/package/transmission/install) 14 | } 15 | 16 | ################################################################################################ Get options 17 | 18 | unset LogBase LogTimes SCLocation DebLocation LogLocation LOCKLocation OutputLOG \ 19 | AppName AppNameLower Need_SourceCode pm_action \ 20 | version mode debug 21 | 22 | AppName=Transmission 23 | AppNameLower=transmission 24 | AppExec=/usr/bin/transmission-daemon 25 | DebName=transmission-all 26 | Need_SourceCode=yes 27 | pm_action=install 28 | 29 | function show_usage() { echo " 30 | $AppName $pm_action $script_version ($script_update) 31 | Usage: 32 | -v Specifiy which version to be installed 33 | -m Install mode, can only be specified as deb, static or source 34 | -l Specifiy LogBase 35 | -d Enable debug mode 36 | " 37 | exit 1 ; } 38 | 39 | OPTS=$(getopt -o v:l:m:d -al mode:,version:,debug,logbase:,log -- "$@") 40 | [ ! $? = 0 ] && show_usage 41 | eval set -- "$OPTS" 42 | 43 | while [ -n "$1" ] ; do case "$1" in 44 | -v | --version ) version="$2" ; shift 2 ;; 45 | -m | --mode ) mode="$2" ; shift 2 ;; 46 | -l | --logbase ) LogTimes="$2" ; shift 2 ;; 47 | -d | --debug ) debug=1 ; shift ;; 48 | --log ) show_log=1 ; shift ;; 49 | -- ) shift ; break ;; 50 | esac ; done 51 | 52 | ################################################################################################ Set Variables 1 53 | 54 | if [[ -f /etc/inexistence/00.Installation/function ]]; then 55 | source /etc/inexistence/00.Installation/function 56 | else 57 | source <(wget -qO- https://github.com/Aniverse/inexistence/raw/master/00.Installation/function) 58 | fi 59 | 60 | set_variables_log_location 61 | check_var_OutputLOG 62 | debug_log_location 63 | cat_outputlog 64 | 65 | script_pid=$$ 66 | trap 'exit 1' TERM 67 | 68 | ################################################################################################ Set Variables 2 69 | 70 | deb_available=('2.94') 71 | git_repo="https://github.com/transmission/transmission" 72 | 73 | [[ -z $mode ]] && [[ -n $(echo "${deb_available[*]}" | grep -w "${version}") ]] && mode=deb 74 | [[ $mode == deb ]] && [[ -z $(echo "${deb_available[*]}" | grep -w "${version}") ]] && echo_error_exit "$version is not available in deb mode" 75 | [[ -z $mode ]] && [[ -n $version ]] && mode=source 76 | [[ ! $mode =~ (source|deb|static) ]] && echo_error_exit "Mode can only be specified as deb, static or source" 77 | [[ -n $version ]] && [[ $mode == source ]] && check_remote_git_repo_branch $git_repo "$version" 78 | 79 | ################################################################################################ 80 | 81 | function install_transmission_deb() { 82 | lines2 >> $OutputLOG 83 | list="transmission-common_2.94-1mod1_all.deb 84 | transmission-cli_2.94-1mod1_amd64.deb 85 | transmission-daemon_2.94-1mod1_amd64.deb 86 | transmission-gtk_2.94-1mod1_amd64.deb 87 | transmission-qt_2.94-1mod1_amd64.deb 88 | transmission_2.94-1mod1_all.deb" 89 | mkdir -p /tmp/tr_deb 90 | cd /tmp/tr_deb 91 | for deb in $list ; do 92 | deb-get transmission $deb install 93 | done 94 | cd 95 | apt-mark hold transmission-common transmission-cli transmission-daemon transmission-gtk transmission-qt transmission >> "$OutputLOG" 2>&1 96 | } 97 | 98 | function install_transmission_dependencies() { 99 | lines2 >> $OutputLOG 100 | apt_install_dependencies libcurl4-openssl-dev libglib2.0-dev libevent-dev libminiupnpc-dev libgtk-3-dev libappindicator3-dev \ 101 | pkg-config automake autoconf cmake libtool intltool build-essential openssl 102 | # https://tieba.baidu.com/p/5532509017?pn=2#117594043156l 103 | [[ $CODENAME == stretch ]] && apt_install_dependencies libssl1.0-dev 104 | } 105 | 106 | function build_libevent() { 107 | # It seems we do not need to build libevent now 108 | lines2 >> $OutputLOG 109 | cd $SCLocation 110 | wget -nv -N https://github.com/libevent/libevent/archive/release-2.1.8-stable.tar.gz >> "$OutputLOG" 2>&1 111 | tar xf release-2.1.8-stable.tar.gz >> "$OutputLOG" 2>&1 112 | rm -rf release-2.1.8-stable.tar.gz >> "$OutputLOG" 2>&1 113 | mv libevent-release-2.1.8-stable libevent-2.1.8 >> "$OutputLOG" 2>&1 114 | cd libevent-2.1.8 >> "$OutputLOG" 2>&1 || echo_error_exit "Failed to cd libevent-2.1.8" 115 | ./autogen.sh >> "$OutputLOG" 2>&1 116 | ./configure >> "$OutputLOG" 2>&1 117 | make -j$MAXCPUS >> "$OutputLOG" 2>&1 118 | make install >> "$OutputLOG" 2>&1 119 | ldconfig >> "$OutputLOG" 2>&1 120 | # ln -s /usr/local/lib/libevent-2.1.so.6 /usr/lib/libevent-2.1.so.6 121 | } 122 | 123 | function build_transmission() { 124 | lines2 >> $OutputLOG 125 | cd $SCLocation 126 | # git clone --depth=1 -b $version https://github.com/transmission/transmission transmission-$version >> "$OutputLOG" 2>&1 127 | wget https://github.com/transmission/transmission-releases/raw/master/transmission-$version.tar.xz >> "$OutputLOG" 2>&1 128 | tar xf transmission-$version.tar.xz >> "$OutputLOG" 2>&1 129 | cd transmission-$version >> "$OutputLOG" 2>&1 || echo_error_exit "Failed to cd transmission source folder" 130 | ./autogen.sh >> "$OutputLOG" 2>&1 131 | ./configure --prefix=/usr >> "$OutputLOG" 2>&1 132 | make -j$MAXCPUS >> "$OutputLOG" 2>&1 133 | make install >> "$OutputLOG" 2>&1 134 | } 135 | 136 | function update_transmission_webui() { 137 | echo 1 | bash -c "$(wget -qO- https://github.com/ronggang/transmission-web-control/raw/master/release/install-tr-control.sh)" >> "$OutputLOG" 2>&1 138 | } 139 | 140 | function check_status_tr() { 141 | tr_installed_ver=$(eval $AppExec --help 2>/dev/null | head -n1 | awk '{print $2}') 142 | if [[ -z $tr_installed_ver ]]; then 143 | status_failed 144 | elif [[ $tr_installed_ver == $version ]]; then 145 | status_done 146 | touch $LOCKLocation/$AppNameLower.lock # touch $LOCKLocation/$AppNameLower{,.source}.lock 147 | echo_task "Updating Transmission WebUI ..." 148 | update_transmission_webui & spinner $! 149 | status_done 150 | restart_app 151 | else 152 | echo_error2 "$tr_installed_ver is installed rather than $version" 153 | fi 154 | } 155 | 156 | 157 | case $mode in 158 | deb ) echo_task "Installing $AppName ${bold}${cyan}$version${normal} from pre-built deb ..." 159 | install_transmission_deb & spinner $! 160 | check_status_tr 161 | ;; 162 | static ) # In fact this mode has not been implemented yet 163 | echo_task "Installing $AppName ${bold}${cyan}$version${normal} static build ..." 164 | install_transmission_static & spinner $! 165 | check_status_tr 166 | ;; 167 | source ) echo_task "Installing $AppName build dependencies ..." 168 | install_transmission_dependencies & spinner $! 169 | check_status $status_lock 170 | echo_task "Installing $AppName ${bold}${cyan}$version${normal} from source codes ..." 171 | build_transmission & spinner $! 172 | check_status_tr 173 | ;; 174 | esac 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | ###################### deprecated ###################### 183 | 184 | function deprecated_codes() { 185 | # 修复 Transmission 2.92 无法在 Ubuntu 18.04 下编译的问题(openssl 1.1.0),https://github.com/transmission/transmission/pull/24 186 | [[ $tr_version == 2.92 ]] && { git config --global user.email "you@example.com" ; git config --global user.name "Your Name" ; git cherry-pick eb8f500 -m 1 ; } 187 | # 修复 2.93 以前的版本可能无法过 configure 的问题,https://github.com/transmission/transmission/pull/215 188 | grep m4_copy_force m4/glib-gettext.m4 -q || sed -i "s/m4_copy/m4_copy_force/g" m4/glib-gettext.m4 189 | } 190 | 191 | -------------------------------------------------------------------------------- /00.Installation/options: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # https://github.com/Aniverse/inexistence 4 | # Author: Aniverse 5 | # 6 | # script_update=2020.08.31 7 | # script_version=r10007 8 | # This var will recover other script's var when source 9 | # 10 | ################################################################################################ 11 | 12 | function show_inex_usage () { 13 | echo -e " 14 | $script_name $script_version ($script_update) 15 | 16 | Usage: $script_cmd [OPTS] 17 | 18 | Options: 19 | -u, --username Specify username 20 | -p. --password Specify password 21 | --qb Specify which qBittorrent version to be installed 22 | --de Specify which Deluge version to be installed 23 | --rt Specify which rTorrent version to be installed 24 | --tr Specify which Transmission version to be installed 25 | --domain Configure SSL for you domain via acme.sh 26 | --hostname Setup hostname (make no change by default) 27 | --mt- How many threads will be used when compiling from source (default max) 28 | -b Specify which branch of inexistence to be installed (default master) 29 | -d, --debug Enable debug mode 30 | -s, --skip Skip system check, allow you to install this script on unsupported distro 31 | -y, --yes Force yes to all questions 32 | --enable-ipv6 Enable IPv6 supoort for rTorrent 33 | --qb-static Install qBittorrent static builds instead of via deb or compile 34 | --qb-source Install qBittorrent by building from source 35 | --tr-deb Install Transmission 2.94 via deb 36 | -h, --help Display this help and exit 37 | 38 | --APPNAME Install an application or enable a function/feature 39 | 40 | Available APPNAME: 41 | vnc | x2go | wine | mono | tools | rclone | flood | flexget | filebrowser | bbr | tweaks | swap 42 | 43 | --no-SOMETHING Do not install something or do not do something 44 | 45 | Available SOMETHING: 46 | flexget | filebrowser | bbr | tweaks | swap | reboot | system-upgrade | source-change 47 | 48 | Example: 49 | $script_cmd -u aniverse -p ajYeTGRkFw42 -y --de 1.3.15 --qb no --rt no \\ 50 | --hostname myseedbox --flexget --no-bbr --rclone --tweaks --tr-deb --vnc \\ 51 | --no-system-upgrade --no-reboot --no-source-change --no-filebrowser 52 | 53 | 中文介绍:https://github.com/Aniverse/inexistence#installation-guide 54 | " 55 | exit 56 | } 57 | 58 | ################################################################################################ 59 | 60 | function opts_action () { 61 | while [ -n "$1" ] ; do case "$1" in 62 | -u | --user ) iUser=$2 ; options_validate_username ; shift 2 ;; 63 | -p | --password ) iPass=$2 ; options_validate_password ; shift 2 ;; 64 | -b | --branch ) iBranch=$2 ; shift 2 ;; 65 | 66 | --de ) de_version=$2 ; shift 2 ;; 67 | --qb ) qb_version=$2 ; shift 2 ;; 68 | --tr ) tr_version=$2 ; shift 2 ;; 69 | --rt ) rt_version=$2 ; shift 2 ;; 70 | --lt ) lt_version=$2 ; shift 2 ;; 71 | --domain ) rt_domain=$2 ; shift 2 ;; 72 | --hostname ) hostname=$2 ; shift 2 ;; 73 | 74 | -d | --debug ) DeBUG=1 ; shift ;; 75 | -s | --skip ) SYSTEMCHECK=0 ; shift ;; 76 | -y | --yes ) ForceYes=1 ; shift ;; 77 | -h | --help ) show_inex_usage ; shift ;; 78 | --separate ) separate=1 ; shift ;; 79 | --quick ) quick=1 ; shift ;; 80 | --qb-static ) qb_mode=static ; shift ;; 81 | --qb-source ) qb_mode=source ; shift ;; 82 | --sihuo ) sihuo=yes ; shift ;; 83 | --eng ) script_lang=eng ; shift ;; 84 | --chs ) script_lang=chs ; shift ;; 85 | --enable-ipv6 ) IPv6Opt=-i ; shift ;; 86 | 87 | --vnc ) InsVNC="Yes" ; shift ;; 88 | --x2go ) InsX2Go="Yes" ; shift ;; 89 | --wine ) InsWine="Yes" ; shift ;; 90 | --mono ) InsMono="Yes" ; shift ;; 91 | --tools ) InsTools="Yes" ; shift ;; 92 | --rclone ) InsRclone="Yes" ; shift ;; 93 | --flood ) InsFlood="Yes" ; shift ;; 94 | 95 | --swap ) USESWAP="Yes" ; shift ;; 96 | --filebrowser ) InsFB="Yes" ; shift ;; 97 | --flexget ) InsFlex="Yes" ; shift ;; 98 | --tweaks ) UseTweaks="Yes" ; shift ;; 99 | --bbr ) InsBBR="Yes" ; shift ;; 100 | 101 | --no-swap ) USESWAP="No" ; shift ;; 102 | --no-filebrowser ) InsFB="No" ; shift ;; 103 | --no-flexget ) InsFlex="No" ; shift ;; 104 | --no-tweaks ) UseTweaks="No" ; shift ;; 105 | --no-bbr ) InsBBR="No" ; shift ;; 106 | --no-source-change) aptsources="No" ; shift ;; 107 | 108 | --no-reboot ) NoReboot=1 ; shift ;; 109 | --mt-single ) MAXCPUS=1 ; shift ;; 110 | --mt-double ) MAXCPUS=2 ; shift ;; 111 | --mt-all ) MAXCPUS=$(nproc) ; shift ;; 112 | --mt-half ) MAXCPUS=$(echo "$(nproc) / 2"|bc) ; shift ;; 113 | --tr-deb ) tr_version=2.94 ; TRdefault=deb ; shift ;; 114 | --no-system-upgrade ) skip_system_upgrade=1 ; shift ;; 115 | 116 | -- ) shift ; break ;; 117 | esac ; done 118 | } 119 | 120 | function options_validate_username() { 121 | reserved_names=('adm' 'admin' 'audio' 'backup' 'bin' 'cdrom' 'crontab' 'daemon' 'dialout' 'dip' 'disk' 'fax' 'floppy' 'fuse' 'games' 'gnats' 'irc' 'kmem' 'landscape' 'libuuid' 'list' 'lp' 'mail' 'man' 'messagebus' 'mlocate' 'netdev' 'news' 'nobody' 'nogroup' 'operator' 'none' 'null' 'plugdev' 'proxy' 'root' 'sasl' 'shadow' 'src' 'ssh' 'sshd' 'staff' 'sudo' 'sync' 'sys' 'syslog' 'tape' 'tty' 'users' 'utmp' 'uucp' 'video' 'voice' 'whoopsie' 'www-data') 122 | count=0 123 | count=$(echo -n "$iUser" | wc -c) 124 | if $(echo "${reserved_names[@]}" | grep -wq "$iUser"); then 125 | echo -e "ERROR: Do not use reversed user name ! 这个用户名不可用,换一个吧" 126 | exit 1 127 | elif [[ $count -lt 3 || $count -gt 32 ]]; then 128 | echo -e "ERROR: User name cannot less than 3 or more than 32 characters ! 用户名长度 3-32 位" 129 | exit 1 130 | elif ! [[ "$iUser" =~ ^[a-z][-a-z0-9_]*$ ]]; then 131 | echo -e "ERROR: Your username must start from a lower case letter and the username" 132 | echo -e "must contain only lowercase letters, numbers, hyphens, and underscores." 133 | echo -e "用户名必须由小写字母开头,只能使用小写字母、数字、连字符、下划线" 134 | exit 1 135 | fi 136 | } 137 | 138 | 139 | function options_validate_password() { 140 | if [ ${#iPass} -lt 8 ]; then # At least [8] chars long 141 | echo -e "ERROR: Password must be at least [8] chars long 密码长度至少要有 8 位" 142 | exit 1 143 | elif ! echo "$iPass" | grep -q '[0-9]'; then # At least [1] number 144 | echo -e "ERROR: Password must have at least [1] number 密码中必须包含数字" 145 | exit 1 146 | elif ! echo "$iPass" | grep -q '[a-zA-Z]'; then # At least [1] letter 147 | echo -e "ERROR: Password must have at least [1] letter 密码中必须包含英文字母" 148 | exit 1 149 | fi 150 | } 151 | 152 | 153 | function options_validate_password_quickbox_lite() { 154 | count=0 155 | count=$(echo -n "$iPass" | wc -c) 156 | strength=$(echo "$iPass" | grep -P '(?=^.{8,32}$)(?=^[^\s]*$)(?=.*\d)(?=.*[A-Z])(?=.*[a-z])') 157 | if [[ $count -lt 8 ]]; then 158 | echo -e "Your password cannot less than 8 characters !" 159 | exit 1 160 | else 161 | if [[ $strength == "" ]]; then 162 | echo -e "Your password must consist:" 163 | echo -e "1. digital numbers" 164 | echo -e "2. at least one lower case letter" 165 | echo -e "3. one upper case letter" 166 | exit 1 167 | fi 168 | fi 169 | } 170 | -------------------------------------------------------------------------------- /00.Installation/package/flexget/install: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # https://github.com/Aniverse/inexistence 4 | # Author: Aniverse 5 | 6 | script_update=2021.09.10 7 | script_version=r30028 8 | 9 | ################################################################################################ Debug 10 | 11 | usage_for_debug() { 12 | export local_packages=/etc/inexistence/00.Installation 13 | export s=$local_packages/package/flexget/install 14 | rm -f $s ; nano $s ; bash $s 15 | bash <(wget -qO- https://github.com/Aniverse/inexistence/raw/master/00.Installation/package/flexget/install) 16 | } 17 | 18 | ################################################################################################ Get options 19 | 20 | unset LogRootPath LogTimes DebLocation SCLocation LOCKLocation OutputLOG \ 21 | user 22 | 23 | AppName=FlexGet 24 | AppNameLower=flexget 25 | Need_SourceCode=no 26 | pm_action=install 27 | 28 | function show_usage() { echo " 29 | $AppName $pm_action $script_version ($script_update) 30 | Usage: 31 | -l Specifiy LogBase (Not log file) 32 | -d Enable debug mode 33 | --log Show logfile's content" 34 | exit 1 ; } 35 | 36 | OPTS=$(getopt -o u:v:l:d -al user:,version:,debug,logbase:,system,log -- "$@") 37 | [ ! $? = 0 ] && show_usage 38 | eval set -- "$OPTS" 39 | 40 | while [ -n "$1" ] ; do case "$1" in 41 | -d | --debug ) debug=1 ; shift ;; 42 | -v | --version ) version="$2" ; shift 2 ;; 43 | -u | --user ) user="$2" ; shift 2 ;; 44 | -l | --logbase ) LogTimes="$2" ; shift 2 ;; 45 | --system ) unset user ; shift ;; 46 | --log ) show_log=1 ; shift ;; 47 | -- ) shift ; break ;; 48 | esac ; done 49 | # -v, -u and --system is deprecated currently 50 | 51 | ################################################################################################ Set Variables 52 | 53 | if [[ -f /etc/inexistence/00.Installation/function ]]; then 54 | source /etc/inexistence/00.Installation/function 55 | else 56 | source <(wget -qO- https://github.com/Aniverse/inexistence/raw/master/00.Installation/function) 57 | fi 58 | 59 | set_variables_log_location 60 | check_var_OutputLOG 61 | debug_log_location 62 | cat_outputlog 63 | 64 | ################################################################################################ 65 | 66 | 67 | 68 | function patch_flexget() { 69 | # pypath=/usr/local/lib/python$(python3 -V | grep -oE "3.[0-9]")/dist-packages 70 | # Debian 9, /usr/local/lib/python3.7/site-packages 71 | pypath=$($python_cmd -m site 2>&1 | grep package | head -1 | cut -d \' -f2) # /opt/venv/flexget/lib/python3.7/site-packages 72 | mkdir -p /tmp 73 | cat << EOF > /tmp/flexget-remove-passwd-check.patch 74 | diff -Nur flexget/webserver.py flexget-patch/webserver.py 75 | --- webserver.py 2020-02-28 11:50:07.423005342 +0800 76 | +++ webserver.py 2020-02-28 11:57:52.831474088 +0800 77 | @@ -241,6 +241,7 @@ 78 | @with_session 79 | def change_password(username='flexget', password='', session=None): 80 | check = zxcvbn.zxcvbn(password, user_inputs=[username]) 81 | + check['score'] = 4 82 | if check['score'] < 3: 83 | warning = check['feedback']['warning'] 84 | suggestions = ' '.join(check['feedback']['suggestions']) 85 | EOF 86 | patch -d ${pypath}/flexget/ < /tmp/flexget-remove-passwd-check.patch >> "$OutputLOG" 2>&1 87 | $python_cmd -m compileall ${pypath}/flexget/webserver.py >> "$OutputLOG" 2>&1 88 | rm -f /tmp/flexget-remove-passwd-check.patch 89 | } 90 | 91 | 92 | function install_python37() { 93 | pyenv_install_python 3.7.8 94 | pyenv_init_venv 3.7.8 /opt/venv/flexget 95 | python_getpip 3.7.8 /opt/venv/flexget 96 | pip_cmd="/opt/venv/flexget/bin/pip" 97 | python_cmd="/opt/venv/flexget/bin/python" 98 | flexget_cmd="/opt/venv/flexget/bin/flexget" 99 | } 100 | 101 | 102 | 103 | function install_flexget3() { 104 | 105 | echo >> $OutputLOG 106 | 107 | $pip_cmd install --upgrade setuptools >> "$OutputLOG" 2>&1 # 45.3.0 108 | $pip_cmd install --upgrade pyopenssl >> "$OutputLOG" 2>&1 109 | $pip_cmd install --upgrade cryptography >> "$OutputLOG" 2>&1 110 | $pip_cmd install --ignore-installed flexget >> "$OutputLOG" 2>&1 # 3.0.31 3.1.77 111 | # For establishing connection with Deluge and Transmission client 112 | $pip_cmd install deluge-client transmissionrpc >> "$OutputLOG" 2>&1 113 | # https://github.com/jerrymakesjelly/autoremove-torrents 114 | $pip_cmd install autoremove-torrents >> "$OutputLOG" 2>&1 115 | 116 | # For third-party plugin flexget_qbittorrent_mod 117 | # https://github.com/IvonWei/flexget_qbittorrent_mod/wiki 118 | # $pip_cmd install brotli baidu-aip pillow python-Levenshtein >> "$OutputLOG" 2>&1 119 | # $pip_cmd install pandas matplotlib fuzzywuzzy >> "$OutputLOG" 2>&1 # selenium 120 | # $pip_cmd install python-telegram-bot==12.8 >> "$OutputLOG" 2>&1 121 | 122 | rm -f /usr/local/bin/flexget >> "$OutputLOG" 2>&1 123 | rm -f /usr/local/bin/autoremove-torrents >> "$OutputLOG" 2>&1 124 | ln -s $local_packages/package/flexget/ffgg $local_script >> "$OutputLOG" 2>&1 125 | ln -s /opt/venv/flexget/bin/flexget /usr/local/bin/flexget >> "$OutputLOG" 2>&1 126 | ln -s /opt/venv/flexget/bin/autoremove-torrents \ 127 | /usr/local/bin/autoremove-torrents >> "$OutputLOG" 2>&1 128 | 129 | patch_flexget 130 | _execute "$flexget_cmd -V" # for debug 131 | 132 | status_lock=$AppNameLower 133 | echo "status_lock=$status_lock" > /tmp/Variables 134 | rm -f /tmp/$status_lock.1.lock /tmp/$status_lock.2.lock 135 | flexget_ver=$($flexget_cmd -V 2>&1 | head -1) 136 | if [[ -n $flexget_ver ]] && version_ge $flexget_ver 3.1.66 ; then 137 | touch /tmp/$status_lock.1.lock 138 | else 139 | touch /tmp/$status_lock.2.lock 140 | fi 141 | [[ -f /tmp/$status_lock.1.lock ]] && touch $LOCKLocation/$AppNameLower.lock 142 | echo >> $OutputLOG 143 | 144 | } 145 | 146 | 147 | 148 | ################################################################################################ 149 | 150 | 151 | if [[ ! -f $LOCKLocation/pyenv.lock ]]; then 152 | bash <(wget -qO- https://github.com/Aniverse/inexistence/raw/master/00.Installation/package/pyenv) 153 | fi 154 | 155 | install_python37 156 | 157 | echo_task "Installing $AppName ..." 158 | install_flexget3 & spinner $! 159 | check_status $status_lock 160 | 161 | [[ $debug == 1 ]] && which flexget 162 | 163 | 164 | ################################################################################################ Deprecated 165 | 166 | 167 | function deprecated_codes_backup_here() { 168 | if [[ "$CODENAME" =~ (jessie|stretch) ]]; then 169 | sed -i "s/\/usr\/bin\/python3/\/usr\/local\/bin\/python3.7/g" /usr/local/bin/flexget 170 | sed -i "s/\/usr\/bin\/python3/\/usr\/local\/bin\/python3.7/g" /usr/local/bin/flexget-headless 171 | update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.4 2 >> "$OutputLOG" 2>&1 # Debian 8 jessie 172 | update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.5 2 >> "$OutputLOG" 2>&1 # Debian 9 stretch 173 | update-alternatives --install /usr/bin/python3 python3 /usr/local/bin/python3.7 1 >> "$OutputLOG" 2>&1 174 | fi 175 | } 176 | 177 | 178 | function install_flexget2_user() { 179 | echo >> $OutputLOG 180 | 181 | apt_install_check python python-dev python-pip 182 | apt_install_separate 183 | python2 -m pip install --upgrade pip >> "$OutputLOG" 2>&1 184 | python2 -m pip install pathlib >> "$OutputLOG" 2>&1 185 | python2 -m pip install transmissionrpc deluge-client >> "$OutputLOG" 2>&1 186 | 187 | if [[ -z $user ]]; then 188 | python2 -m pip install flexget >> "$OutputLOG" 2>&1 189 | else 190 | su $user -c 'python2 -m pip install flexget --user' >> "$OutputLOG" 2>&1 191 | export PATH=/home/$user/.local/bin:$PATH 192 | fi 193 | 194 | status_lock=$AppNameLower 195 | echo "status_lock=$status_lock" > /tmp/Variables 196 | rm -f /tmp/$status_lock.1.lock /tmp/$status_lock.2.lock 197 | which flexget > /dev/null && touch /tmp/$status_lock.1.lock || touch /tmp/$status_lock.2.lock 198 | [[ -f /tmp/$status_lock.1.lock ]] && touch $LOCKLocation/$AppNameLower.lock 199 | echo >> $OutputLOG 200 | } 201 | -------------------------------------------------------------------------------- /00.Installation/package/filebrowser: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # https://github.com/Aniverse/inexistence 4 | # Author: Aniverse 5 | 6 | script_update=2020.08.09 7 | script_version=r11014 8 | 9 | ################################################################################################ Debug 10 | 11 | usage_for_debug() { 12 | export local_packages=/etc/inexistence/00.Installation 13 | export s=$local_packages/package/filebrowser 14 | rm -f $s ; nano $s 15 | if [[ -f /etc/inexistence/00.Installation/package/filebrowser ]]; then 16 | bash /etc/inexistence/00.Installation/package/filebrowser -u $iUser -p $iPass 17 | else 18 | bash <(wget -qO- https://github.com/Aniverse/inexistence/raw/master/00.Installation/package/filebrowser) 19 | fi 20 | } 21 | 22 | ################################################################################################ 23 | 24 | unset LogRootPath LogTimes DebLocation SCLocation LOCKLocation OutputLOG 25 | 26 | function show_usage() { echo " 27 | $AppName $pm_action $script_version ($script_update) 28 | Usage: 29 | -u Username for FileBrowser 30 | -p Password for FileBrowser 31 | -l Specifiy LogBase (Not log file) 32 | -d Enable debug mode 33 | -w WebUI port for FileBrowser 34 | -f Force recover existing configuration 35 | --log Show logfile's content" 36 | exit 1 ; } 37 | 38 | OPTS=$(getopt -o v:l:w:u:df -al username:,password:,version:,debug,logbase:,wport:,log,force -- "$@") 39 | [ ! $? = 0 ] && show_usage 40 | eval set -- "$OPTS" 41 | 42 | while [ -n "$1" ] ; do case "$1" in 43 | -u | --username ) iUser="$2" ; shift 2 ;; 44 | -p | --password ) iPass="$2" ; shift 2 ;; 45 | -v | --version ) version="$2" ; shift 2 ;; 46 | -l | --logbase ) LogTimes="$2" ; shift 2 ;; 47 | -w | --wport ) wPort="$2" ; shift 2 ;; 48 | -d | --debug ) debug=1 ; shift ;; 49 | -f | --force ) force=1 ; shift ;; 50 | --log ) show_log=1 ; shift ;; 51 | -- ) shift ; break ;; 52 | esac ; done 53 | 54 | AppName=FileBrowser 55 | AppNameLower=filebrowser 56 | AppExec="" 57 | AppTest="docker ps | grep filebrowser | grep $iUser" 58 | Need_SourceCode=no 59 | pm_action=install 60 | 61 | ################################################################################################ Set Variables 62 | 63 | if [[ -f /etc/inexistence/00.Installation/function ]]; then 64 | source /etc/inexistence/00.Installation/function 65 | else 66 | source <(wget -qO- https://github.com/Aniverse/inexistence/raw/master/00.Installation/function) 67 | fi 68 | 69 | set_variables_log_location 70 | check_var_OutputLOG 71 | debug_log_location 72 | cat_outputlog 73 | check_var_iUser_iPass_iHome 74 | 75 | [[ -z $wPort ]] && wPort=7575 76 | wPort2=7576 77 | [[ -z $lang ]] && lang=zh-cn 78 | PortCheck $wPort 79 | [[ $port_used == 1 ]] && echo_error_exit "Please change your port" 80 | 81 | ################################################################################################ 82 | 83 | function get_filebrowser_origin () { 84 | mkdir -p /tmp/fb && cd /tmp/fb 85 | # wget -nv https://github.com/filebrowser/filebrowser/releases/download/v2.0.16/linux-amd64-filebrowser.tar.gz >> "$OutputLOG" 2>&1 86 | latest=$(wget -qO- https://api.github.com/repos/filebrowser/filebrowser/releases/latest | grep browser_download_url | grep linux-amd64 | cut -d '"' -f 4) 87 | wget $latest -O linux-amd64-filebrowser.tar.gz >> "$OutputLOG" 2>&1 88 | tar zxf linux-amd64-filebrowser.tar.gz >> "$OutputLOG" 2>&1 89 | mv /tmp/fb/filebrowser /usr/local/bin/filebrowser >> "$OutputLOG" 2>&1 90 | cd && rm -rf /tmp/fb/filebrowser 91 | } 92 | 93 | function get_filebrowser_ee () { 94 | docker pull 80x86/filebrowser:amd64 >> "$OutputLOG" 2>&1 95 | } 96 | 97 | function create_filebrowser_conf () { 98 | local user=$1 99 | [[ $user == root ]] && local uhome=/root || local uhome=/home/$user 100 | rm -rf $uhome/.config/filebrowser-ee 101 | mkdir -p $uhome/.config/filebrowser-ee/log 102 | /usr/local/bin/filebrowser -d $uhome/.config/filebrowser-ee/database.db config init >> "$OutputLOG" 2>&1 103 | /usr/local/bin/filebrowser -d $uhome/.config/filebrowser-ee/database.db config set --locale $lang >> "$OutputLOG" 2>&1 104 | /usr/local/bin/filebrowser -d $uhome/.config/filebrowser-ee/database.db users add $iUser $iPass --perm.admin >> "$OutputLOG" 2>&1 105 | chown ${user}.${user} -R ${uhome}/.config/filebrowser-ee/ 106 | } 107 | 108 | function create_filebrowser_systemd () { 109 | local user=$1 110 | _UID=$(id -u ${user}) 111 | _GID=$(id -g ${user}) 112 | if [[ $user == root ]]; then 113 | local unit=filebrowser-root.service 114 | local suffix="" 115 | local mountpoint="/" 116 | local PORT=$wPort2 117 | local uhome=/root 118 | local url=fb 119 | else 120 | local unit=filebrowser@${user}.service 121 | local suffix="-${user}" 122 | local mountpoint="/home/${user}/" 123 | local PORT=$wPort 124 | local uhome=/home/$user 125 | local url=filebrowser 126 | fi 127 | cat << EOF > /etc/systemd/system/$unit 128 | [Unit] 129 | Description=File Browser Enhanced Edition 130 | After=docker.service 131 | Requires=docker.service 132 | 133 | [Service] 134 | TimeoutStartSec=0 135 | ExecStartPre=-/usr/bin/docker stop filebrowser${suffix} 136 | ExecStartPre=-/usr/bin/docker rm filebrowser${suffix} 137 | #ExecStartPre=/usr/bin/docker pull 80x86/filebrowser:amd64 138 | ExecStart=/usr/bin/docker run \ 139 | -e PUID=$_UID \ 140 | -e PGID=$_GID \ 141 | -e WEB_PORT=${PORT} \ 142 | -e UMASK_SET=133 \ 143 | -e FB_BASEURL="/$url/" \ 144 | -p ${PORT}:${PORT} \ 145 | -v ${uhome}/.config/filebrowser-ee:/config \ 146 | -v ${mountpoint}:/myfiles \ 147 | --mount type=tmpfs,destination=/tmp \ 148 | --restart=always \ 149 | --name="filebrowser${suffix}" \ 150 | 80x86/filebrowser:amd64 151 | ExecStop=/usr/bin/docker stop filebrowser${suffix} 152 | 153 | [Install] 154 | WantedBy=multi-user.target 155 | EOF 156 | systemctl daemon-reload >> "$OutputLOG" 2>&1 157 | } 158 | 159 | 160 | function write_filebrowser_nginx_reverse_proxy () { 161 | # Nginx Reverse 162 | # Currently this is only for the first non-root user 163 | if [[ -d /etc/nginx/apps ]]; then 164 | cat << 'EOF' > /etc/nginx/apps/filebrowser.conf 165 | location /fb { 166 | return 301 /fb/; 167 | } 168 | 169 | location /filebrowser { 170 | return 301 /filebrowser/; 171 | } 172 | 173 | location /fb/ { 174 | rewrite ^/fb/(.*) /$1 break; 175 | proxy_pass http://fb; 176 | proxy_http_version 1.1; 177 | proxy_set_header Upgrade $http_upgrade; 178 | proxy_set_header Connection "upgrade"; 179 | proxy_set_header Host $host; 180 | } 181 | 182 | location /filebrowser/ { 183 | rewrite ^/filebrowser/(.*) /$1 break; 184 | proxy_pass http://filebrowser; 185 | proxy_http_version 1.1; 186 | proxy_set_header Upgrade $http_upgrade; 187 | proxy_set_header Connection "upgrade"; 188 | proxy_set_header Host $host; 189 | } 190 | EOF 191 | cat << EOF > /etc/nginx/conf.d/filebrowser.conf 192 | upstream filebrowser { 193 | server 127.0.0.1:${wPort}; 194 | } 195 | 196 | upstream fb { 197 | server 127.0.0.1:${wPort2}; 198 | } 199 | EOF 200 | nginx -s reload >> "$OutputLOG" 2>&1 201 | fi 202 | } 203 | 204 | 205 | function filebrowser_root () { 206 | if [[ ! -f /root/.config/filebrowser-ee/database.db ]]; then 207 | create_filebrowser_conf root 208 | create_filebrowser_systemd root 209 | # systemctl enable filebrowser-root --now >> "$OutputLOG" 2>&1 210 | fi 211 | } 212 | 213 | 214 | function install_filebrowser_ee () { 215 | get_filebrowser_origin 216 | get_filebrowser_ee 217 | 218 | filebrowser_root 219 | create_filebrowser_conf $iUser 220 | create_filebrowser_systemd $iUser 221 | write_filebrowser_nginx_reverse_proxy 222 | systemctl enable filebrowser@${iUser} >> "$OutputLOG" 2>&1 223 | systemctl start filebrowser@${iUser} >> "$OutputLOG" 2>&1 224 | 225 | check_if_succeed 20 "$AppTest" 226 | # Debug 227 | docker ps >> "$OutputLOG" 2>&1 228 | echo "iUser=$iUser" >> "$OutputLOG" 2>&1 229 | echo "waits=$waits" >> "$OutputLOG" 2>&1 230 | 231 | generate_status_lock 232 | } 233 | 234 | ################################################################################################ 235 | 236 | install_base docker 237 | which docker > /dev/null || echo_error_exit "No Docker found" 238 | 239 | if [[ -d $iHome/.config/filebrowser-ee ]] && [[ $force != 1 ]] ;then 240 | echo -e "Configuration for $iUser already exists, skip configuration ..." 241 | else 242 | echo_task "Installing $AppName ..." 243 | install_filebrowser_ee & spinner $! 244 | check_status $AppNameLower 245 | fi 246 | -------------------------------------------------------------------------------- /00.Installation/package/novnc/configure: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # https://github.com/Aniverse/inexistence 4 | # Author: Aniverse 5 | # 6 | script_update=2020.07.15 7 | script_version=r12013 8 | 9 | ################################################################################################ Debug 10 | 11 | usage_for_debug() { 12 | export local_packages=/etc/inexistence/00.Installation 13 | export s=$local_packages/package/novnc/configure 14 | rm -f $s ; nano $s 15 | bash /etc/inexistence/00.Installation/package/novnc/configure -u $iUser -p $iPass 16 | bash <(wget -qO- https://github.com/Aniverse/inexistence/raw/master/00.Installation/package/novnc/configure) 17 | } 18 | 19 | ################################################################################################ Get options 20 | 21 | unset LogRootPath LogTimes DebLocation SCLocation LOCKLocation OutputLOG \ 22 | iUser iPass iHome wPort iPort lang 23 | 24 | AppName=noVNC 25 | AppNameLower=novnc 26 | Need_SourceCode=no 27 | pm_action=configure 28 | 29 | function show_usage() { echo " 30 | $AppName $pm_action $script_version ($script_update) 31 | Usage: 32 | -u Username for $AppName 33 | -p Password for $AppName 34 | -h Specifiy user's home path 35 | -w WebUI port (noVNC) 36 | -i VNC port 37 | -d Enable debug mode 38 | -f Force recover existing configuration 39 | --log Show logfile's content 40 | --root Enable root user's VNC" 41 | exit 1 ; } 42 | 43 | OPTS=$(getopt -a -o u:p:w:i:l:dhf --long "username:,password:,home:,wport:,iport:,lang:,logbase:,debug,log,root,help,force" -- "$@") 44 | [ ! $? = 0 ] && show_usage 45 | eval set -- "$OPTS" 46 | while true; do 47 | case "$1" in 48 | -u | --username ) iUser="$2" ; shift 2 ;; 49 | -p | --password ) iPass="$2" ; shift 2 ;; 50 | -h | --home ) iHome="$2" ; shift 2 ;; 51 | -w | --wport ) wPort="$2" ; shift 2 ;; 52 | -i | --iport ) iPort="$2" ; shift 2 ;; 53 | -l | --lang ) lang="$2" ; shift 2 ;; 54 | -d | --debug ) debug=1 ; shift ;; 55 | -f | --force ) force=1 ; shift ;; 56 | -h | --help ) show_usage ; exit 0 ; shift ;; 57 | --root ) enable_root=1 ; shift ;; 58 | --log ) show_log=1 ; shift ;; 59 | --logbase ) LogTimes="$2" ; shift 2 ;; 60 | -- ) shift 2 ; break ;; 61 | * ) break ;; 62 | esac 63 | done 64 | 65 | ################################################################################################ Set Variables 1 66 | 67 | if [[ -f /etc/inexistence/00.Installation/function ]]; then 68 | source /etc/inexistence/00.Installation/function 69 | else 70 | source <(wget -qO- https://github.com/Aniverse/inexistence/raw/master/00.Installation/function) 71 | fi 72 | 73 | set_variables_log_location 74 | check_var_OutputLOG 75 | debug_log_location 76 | cat_outputlog 77 | check_var_iUser_iPass_iHome 78 | 79 | ################################################################################################ Set Variables 2 80 | 81 | wPortBase=608 82 | iPortBase=590 83 | exist_vnc=$(ls /etc/systemd/system | grep tightvnc | wc -l) 84 | [[ $exist_vnc == 0 ]] && exist_vnc=1 # 1 is for root 85 | vnc_num=$(expr $exist_vnc + 1) 86 | [[ -z $wPort ]] && wPort=$wPortBase$vnc_num # Default 6800 87 | [[ -z $iPort ]] && iPort=$iPortBase$vnc_num # Starts at 5901 88 | 89 | PortCheck $wPort $iPort 90 | [[ $port_used == 1 ]] && echo_error "Please change your port" && exit 1 91 | 92 | ################################################################################################ 93 | 94 | function configure_novnc() { 95 | 96 | echo >> $OutputLOG 97 | 98 | 99 | if [[ ! -f "/etc/systemd/system/tightvnc1.service" ]]; then 100 | cat << EOF > /etc/systemd/system/tightvnc1.service 101 | [Unit] 102 | Description=Remote desktop service (TightVNC) 103 | After=syslog.target network.target 104 | 105 | [Service] 106 | User=root 107 | Type=forking 108 | PIDFile=/root/.vnc/%H:1.pid 109 | ExecStartPre=/bin/sh -c "/usr/bin/vncserver -kill :1 > /dev/null 2>&1 || :" 110 | ExecStart=/usr/bin/vncserver -depth 24 -geometry 1440x900 :1 111 | ExecStop=/usr/bin/vncserver -kill :1 || : 112 | 113 | KillMode=mixed 114 | Restart=on-failure 115 | 116 | [Install] 117 | WantedBy=multi-user.target 118 | EOF 119 | cat << EOF > /etc/systemd/system/novnc1.service 120 | [Unit] 121 | Description=novnc websockify 122 | After=network.target 123 | 124 | [Service] 125 | Type=simple 126 | User=root 127 | PIDFile=${web_root}/novnc/utils/%H:1.pid 128 | ExecStart=${web_root}/novnc/utils/launch.sh --vnc 127.0.0.1:${iPortBase}1 --listen ${wPortBase}1 & 129 | KillMode=process 130 | Restart=on-failure 131 | 132 | [Install] 133 | WantedBy=multi-user.target 134 | EOF 135 | systemctl daemon-reload 136 | 137 | mkdir -p /root/.vnc >> $OutputLOG 2>&1 138 | cat << EOF > /root/.vnc/xstartup 139 | #!/bin/bash 140 | xrdb $iHome/.Xresources 141 | startxfce4 & 142 | EOF 143 | chmod +x /root/.vnc/xstartup 144 | prog=/usr/bin/vncpasswd 145 | runuser -l root -c /usr/bin/expect >> $OutputLOG 2>&1 << EOF 146 | spawn "$prog" 147 | expect "Password:" 148 | send "$iPass\r" 149 | expect "Verify:" 150 | send "$iPass\r" 151 | expect "(y/n)?\r" 152 | send "n\r" 153 | expect dof 154 | exit 155 | EOF 156 | if [[ $enable_root == 1 ]]; then 157 | systemctl start tightvnc1 >> $OutputLOG 2>&1 158 | systemctl enable tightvnc1 >> $OutputLOG 2>&1 159 | systemctl start novnc1 >> $OutputLOG 2>&1 160 | systemctl enable novnc1 >> $OutputLOG 2>&1 161 | fi 162 | fi 163 | 164 | # Write separate systemd service 165 | cat << EOF > /etc/systemd/system/tightvnc${vnc_num}@.service 166 | [Unit] 167 | Description=Remote desktop service (TightVNC) 168 | After=syslog.target network.target 169 | 170 | [Service] 171 | # VncNum ${vnc_num} 172 | User=%I 173 | #Group=${iUser} 174 | #PAMName=login 175 | #Type=forking 176 | 177 | PIDFile=/home/$iUser/.vnc/%H:${vnc_num}.pid 178 | ExecStartPre=/bin/sh -c "/usr/bin/vncserver -kill :${vnc_num} > /dev/null 2>&1 || :" 179 | ExecStart=/usr/bin/vncserver -depth 24 -geometry 1440x900 :${vnc_num} 180 | ExecStop=/usr/bin/vncserver -kill :${vnc_num} || : 181 | 182 | KillMode=mixed 183 | Restart=on-failure 184 | 185 | [Install] 186 | WantedBy=multi-user.target 187 | EOF 188 | cat << EOF > /etc/systemd/system/novnc${vnc_num}.service 189 | [Unit] 190 | Description=novnc websockify 191 | After=network.target 192 | 193 | [Service] 194 | Type=simple 195 | User=root 196 | PIDFile=${web_root}/novnc/utils/%H:${vnc_num}.pid 197 | ExecStart=${web_root}/novnc/utils/launch.sh --vnc 127.0.0.1:${iPort} --listen ${wPort} & 198 | KillMode=process 199 | Restart=on-failure 200 | 201 | [Install] 202 | WantedBy=multi-user.target 203 | EOF 204 | systemctl daemon-reload >> $OutputLOG 2>&1 205 | 206 | 207 | mkdir -p ${iHome}/.vnc ${iHome}/.config >> $OutputLOG 2>&1 208 | cat << EOF > ${iHome}/.vnc/xstartup 209 | #!/bin/bash 210 | xrdb $iHome/.Xresources 211 | startxfce4 & 212 | EOF 213 | chmod +x ${iHome}/.vnc/xstartup 214 | chown ${iUser}:${iUser} -R /home/${iUser}/.vnc >> $OutputLOG 2>&1 215 | 216 | # Set VNC password 217 | prog=/usr/bin/vncpasswd 218 | runuser -l $iUser -c /usr/bin/expect >> $OutputLOG 2>&1 << EOF 219 | spawn "$prog" 220 | expect "Password:" 221 | send "$iPass\r" 222 | expect "Verify:" 223 | send "$iPass\r" 224 | expect "(y/n)?\r" 225 | send "n\r" 226 | expect dof 227 | exit 228 | EOF 229 | chown ${iUser}:${iUser} -R ${iHome}/.config >> $OutputLOG 2>&1 230 | 231 | 232 | # Nginx Reverse 233 | # Currently this is only for the first non-root user 234 | if [[ -d /etc/nginx/apps ]]; then 235 | cat << EOF > /etc/nginx/apps/vnc.conf 236 | location /websockify { 237 | proxy_http_version 1.1; 238 | proxy_pass http://127.0.0.1:$wPort/; 239 | proxy_set_header Upgrade \$http_upgrade; 240 | proxy_set_header Connection "upgrade"; 241 | proxy_read_timeout 61s; 242 | proxy_buffering off; 243 | } 244 | 245 | location /vnc { 246 | index vnc.html; 247 | alias ${web_root}/novnc/; 248 | try_files \$uri \$uri/ /index.php?q=\$uri&\$args; 249 | auth_basic "Password Required"; 250 | auth_basic_user_file /etc/nginx/.htpasswd; 251 | } 252 | EOF 253 | cat << EOF > /etc/nginx/conf.d/novnc.conf 254 | upstream novnc { 255 | server 127.0.0.1:${wPort}; 256 | } 257 | EOF 258 | nginx -s reload >> $OutputLOG 2>&1 259 | fi 260 | 261 | # echo -e "$wPort\n$iPort" > $PortLocation/$iUser.$AppNameLower 262 | 263 | DEBIAN_FRONTEND=noninteractive 264 | systemctl enable tightvnc${vnc_num}@$iUser >> $OutputLOG 2>&1 265 | systemctl enable novnc${vnc_num} >> $OutputLOG 2>&1 266 | systemctl start tightvnc${vnc_num}@$iUser >> $OutputLOG 2>&1 267 | systemctl start novnc${vnc_num} >> $OutputLOG 2>&1 268 | sleep 5 269 | _execute "systemctl status novnc2" 270 | _execute "systemctl status tightvnc${vnc_num}@$iUser" 271 | 272 | # To increase security, use SSH Tunnel to connet it 273 | iptables -A INPUT -p tcp -s localhost --dport $iPort -j ACCEPT >> $OutputLOG 2>&1 274 | iptables -A INPUT -p tcp --dport $iPort -j DROP >> $OutputLOG 2>&1 275 | netfilter-persistent save >> $OutputLOG 2>&1 276 | 277 | status_lock=$AppName-c 278 | echo "status_lock=$status_lock" > /tmp/Variables 279 | rm -f /tmp/$status_lock.1.lock /tmp/$status_lock.2.lock 280 | psaux=$(ps aux) 281 | if [[ $(systemctl is-active tightvnc${vnc_num}@$iUser) == active ]] && [[ $(systemctl is-active novnc2) == active ]]; then 282 | touch /tmp/$status_lock.1.lock 283 | elif echo $psaux | egrep -q "Xtightvnc|xfce4-session|novnc" ; then 284 | touch /tmp/$status_lock.1.lock 285 | else 286 | touch /tmp/$status_lock.2.lock 287 | fi 288 | echo >> $OutputLOG 289 | } 290 | 291 | 292 | 293 | if [[ -d ${iHome}/.vnc ]] && [[ $force != 1 ]] ;then 294 | echo -e "Configuration for $iUser already exists, skip configuration ..." 295 | else 296 | echo_task "Configuring $AppName ..." 297 | configure_novnc & spinner $! 298 | check_status $status_lock 299 | fi 300 | 301 | -------------------------------------------------------------------------------- /00.Installation/package/transmission/configure: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # https://github.com/Aniverse/inexistence 4 | # Author: Aniverse 5 | # 6 | script_update=2020.09.07 7 | script_version=r10009 8 | 9 | ################################################################################################ Debug 10 | 11 | usage_for_debug() { 12 | export local_packages=/etc/inexistence/00.Installation 13 | export s=$local_packages/package/transmission/configure 14 | rm -f $s ; nano $s 15 | bash /etc/inexistence/00.Installation/package/transmission/configure -u $iUser -p $iPass -w 9099 16 | bash <(wget -qO- https://github.com/Aniverse/inexistence/raw/master/00.Installation/package/transmission/configure) 17 | } 18 | 19 | ################################################################################################ Get options 20 | 21 | unset LogRootPath LogTimes DebLocation SCLocation LOCKLocation OutputLOG \ 22 | iUser iPass iHome wPort iPort lang 23 | 24 | AppName=Transmission 25 | AppNameLower=transmission 26 | Need_SourceCode=no 27 | pm_action=configure 28 | 29 | function show_usage() { echo " 30 | $AppName $pm_action $script_version ($script_update) 31 | Usage: 32 | -u Username for $AppName 33 | -p Password for $AppName 34 | -h Specifiy user's home path 35 | -w WebUI port for $AppName 36 | -i Incoming port for $AppName 37 | -d Enable debug mode 38 | -f Force recover existing configuration 39 | --log Show logfile's content" 40 | exit 1 ; } 41 | 42 | OPTS=$(getopt -a -o u:p:w:i:l:dhf --long "username:,password:,home:,wport:,iport:,lang:,logbase:,debug,log,help,force" -- "$@") 43 | [ ! $? = 0 ] && show_usage 44 | eval set -- "$OPTS" 45 | while true; do 46 | case "$1" in 47 | -u | --username ) iUser="$2" ; shift 2 ;; 48 | -p | --password ) iPass="$2" ; shift 2 ;; 49 | -h | --home ) iHome="$2" ; shift 2 ;; 50 | -w | --wport ) wPort="$2" ; shift 2 ;; 51 | -i | --iport ) iPort="$2" ; shift 2 ;; 52 | -l | --lang ) lang="$2" ; shift 2 ;; 53 | -d | --debug ) debug=1 ; shift ;; 54 | -f | --force ) force=1 ; shift ;; 55 | -h | --help ) show_usage ; exit 0 ; shift ;; 56 | --log ) show_log=1 ; shift ;; 57 | --logbase ) LogTimes="$2" ; shift 2 ;; 58 | -- ) shift 2 ; break ;; 59 | * ) break ;; 60 | esac 61 | done 62 | 63 | ################################################################################################ Set Variables 1 64 | 65 | if [[ -f /etc/inexistence/00.Installation/function ]]; then 66 | source /etc/inexistence/00.Installation/function 67 | else 68 | source <(wget -qO- https://github.com/Aniverse/inexistence/raw/master/00.Installation/function) 69 | fi 70 | 71 | set_variables_log_location 72 | check_var_OutputLOG 73 | debug_log_location 74 | cat_outputlog 75 | check_var_iUser_iPass_iHome 76 | 77 | ################################################################################################ Set Variables 2 78 | 79 | [[ -z $wPort ]] && wPort=9099 80 | [[ -z $iPort ]] && iPort=52333 # Default: 51413 ? 81 | PortCheck $wPort $iPort 82 | [[ $port_used == 1 ]] && echo_error "Please change your port" && exit 1 83 | 84 | tr_installed_ver=$(transmission-daemon --help | head -n1 | awk '{print $2}') 85 | 86 | ################################################################################################ 87 | 88 | 89 | function write_transmission_systemd() { 90 | cat << EOF > /etc/systemd/system/transmission@.service 91 | [Unit] 92 | Description=Transmission BitTorrent Daemon 93 | After=network.target 94 | 95 | [Service] 96 | User=%I 97 | Type=simple 98 | LimitNOFILE=infinity 99 | ExecStart=/usr/bin/transmission-daemon -f --log-error -e /home/%i/.config/transmission-daemon/transmission.log 100 | # -g /home/%i/.config/transmission-daemon 101 | ExecReload=/bin/kill -s HUP $MAINPID 102 | ExecStop=/bin/kill -9 $MAINPID 103 | 104 | [Install] 105 | WantedBy=multi-user.target 106 | EOF 107 | systemctl daemon-reload >> $OutputLOG 2>&1 108 | } 109 | 110 | 111 | function write_transmission_nginx_reverse_proxy() { 112 | # Currently this is only for the first non-root user 113 | if [[ -d /etc/nginx/apps ]] && [[ ! -f /etc/nginx/apps/transmission.conf ]]; then 114 | cat << EOF > /etc/nginx/apps/transmission.conf 115 | location /tr { 116 | return 301 /transmission/web/; 117 | } 118 | location /transmission { 119 | proxy_read_timeout 300; 120 | proxy_pass_header X-Transmission-Session-Id; 121 | proxy_set_header X-Forwarded-Host \$host; 122 | proxy_set_header X-Forwarded-Server \$host; 123 | proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for; 124 | proxy_pass http://127.0.0.1:$wPort/transmission; 125 | } 126 | location /rpc { 127 | proxy_pass http://127.0.0.1:$wPort/transmission/rpc; 128 | } 129 | location /upload { 130 | proxy_pass http://127.0.0.1:$wPort/transmission/upload; 131 | } 132 | EOF 133 | nginx -s reload >> "$OutputLOG" 2>&1 134 | fi 135 | } 136 | 137 | 138 | function write_transmission_settings() { 139 | cat << EOF > $iHome/.config/transmission-daemon/settings.json 140 | { 141 | "alt-speed-down": 50, 142 | "alt-speed-enabled": false, 143 | "alt-speed-time-begin": 540, 144 | "alt-speed-time-day": 127, 145 | "alt-speed-time-enabled": false, 146 | "alt-speed-time-end": 1020, 147 | "alt-speed-up": 50, 148 | "bind-address-ipv4": "0.0.0.0", 149 | "bind-address-ipv6": "::", 150 | "blocklist-enabled": false, 151 | "blocklist-url": "http://www.example.com/blocklist", 152 | "cache-size-mb": 4, 153 | "dht-enabled": false, 154 | "download-dir": "$iHome/transmission/download", 155 | "download-queue-enabled": false, 156 | "download-queue-size": 99, 157 | "encryption": 1, 158 | "idle-seeding-limit": 1800, 159 | "idle-seeding-limit-enabled": false, 160 | "incomplete-dir": "$iHome/transmission/incomplete", 161 | "incomplete-dir-enabled": false, 162 | "lazy-bitfield-enabled": true, 163 | "lpd-enabled": false, 164 | "message-level": 2, 165 | "open-file-limit": 100000, 166 | "peer-limit-global": 10000, 167 | "peer-limit-per-torrent": 5000, 168 | "peer-port": $iPort, 169 | "peer-port-random-high": 65535, 170 | "peer-port-random-low": 49152, 171 | "peer-port-random-on-start": true, 172 | "peer-socket-tos": "default", 173 | "pex-enabled": false, 174 | "pidfile": "/$iHome/.config/transmission-daemon/transmission-daemon.pid", 175 | "port-forwarding-enabled": true, 176 | "preallocation": 1, 177 | "prefetch-enabled": 1, 178 | "proxy": "", 179 | "proxy-auth-enabled": false, 180 | "proxy-auth-password": "", 181 | "proxy-auth-username": "", 182 | "proxy-enabled": false, 183 | "proxy-port": 80, 184 | "proxy-type": 0, 185 | "queue-stalled-enabled": false, 186 | "queue-stalled-minutes": 300, 187 | "ratio-limit": 99, 188 | "ratio-limit-enabled": false, 189 | "rename-partial-files": true, 190 | "rpc-authentication-required": true, 191 | "rpc-bind-address": "0.0.0.0", 192 | "rpc-enabled": true, 193 | "rpc-password": "$iPass", 194 | "rpc-port": $wPort, 195 | "rpc-url": "/transmission/", 196 | "rpc-username": "$iUser", 197 | "rpc-whitelist": "*.*.*.*", 198 | "rpc-whitelist-enabled": false, 199 | "scrape-paused-torrents-enabled": true, 200 | "script-torrent-done-enabled": false, 201 | "script-torrent-done-filename": "", 202 | "seed-queue-enabled": false, 203 | "seed-queue-size": 5000, 204 | "speed-limit-down": 1024000, 205 | "speed-limit-down-enabled": false, 206 | "speed-limit-up": 1024000, 207 | "speed-limit-up-enabled": false, 208 | "start-added-torrents": true, 209 | "trash-original-torrent-files": false, 210 | "umask": 0, 211 | "upload-slots-per-torrent": 2000, 212 | "utp-enabled": false, 213 | "watch-dir": "$iHome/transmission/watch", 214 | "watch-dir-enabled": true 215 | } 216 | 217 | EOF 218 | } 219 | 220 | 221 | ################################################################################################ 222 | 223 | function configure_transmission() { 224 | 225 | echo >> $OutputLOG 226 | 227 | backup_old_config transmission-daemon 228 | mkdir -p $iHome/transmission/{download,torrent,watch} $iHome/.config/transmission-daemon $local_script $PortLocation 229 | if [[ -f $local_packages/package/transmission/ttrr ]]; then 230 | ln -s $local_packages/package/transmission/ttrr $local_script/ttrr >> $OutputLOG 2>&1 231 | else 232 | wget -nv https://github.com/Aniverse/inexistence/raw/master/00.Installation/package/transmission/ttrr -O $local_script/ttrr >> $OutputLOG 2>&1 233 | chmod +x $local_script/ttrr 234 | fi 235 | 236 | write_transmission_settings 237 | write_transmission_systemd 238 | write_transmission_nginx_reverse_proxy 239 | 240 | chmod -R 755 $iHome/transmission $iHome/.config/transmission-daemon >> $OutputLOG 2>&1 241 | chown -R $iUser.$iUser $iHome/transmission $iHome/.config/transmission-daemon >> $OutputLOG 2>&1 242 | 243 | echo $wPort > $PortLocation/$iUser.$AppNameLower 244 | systemctl enable transmission@$iUser >> $OutputLOG 2>&1 245 | systemctl start transmission@$iUser >> $OutputLOG 2>&1 246 | sleep 2 247 | systemctl status transmission@$iUser >> $OutputLOG 2>&1 248 | [[ -d /var/www/h5ai/$iUser ]] && ln -s $iHome/transmission/download /var/www/h5ai/$iUser/transmission >> $OutputLOG 2>&1 249 | 250 | status_lock=$AppName-c 251 | echo "status_lock=$status_lock" > /tmp/Variables 252 | rm -f /tmp/$status_lock.1.lock /tmp/$status_lock.2.lock 253 | # full program name will not be displayed, so just transmiss not transmission-daemon 254 | ps --user $iUser | grep transmiss -q && touch /tmp/$status_lock.1.lock || touch /tmp/$status_lock.2.lock 255 | echo >> $OutputLOG 256 | 257 | } 258 | 259 | 260 | 261 | if [[ -d $iHome/.config/transmission-daemon ]] && [[ $force != 1 ]] ;then 262 | echo -e "Configuration for $iUser already exists, skip configuration ..." 263 | else 264 | echo_task "Configuring $AppName ..." 265 | configure_transmission & spinner $! 266 | check_status $status_lock 267 | fi 268 | -------------------------------------------------------------------------------- /00.Installation/package/qbittorrent/configure: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # https://github.com/Aniverse/inexistence 4 | # Author: Aniverse 5 | # 6 | script_update=2021.07.30 7 | script_version=r12051 8 | 9 | ################################################################################################ Debug 10 | 11 | usage_for_debug() { 12 | export local_packages=/etc/inexistence/00.Installation 13 | export s=$local_packages/package/qbittorrent/configure 14 | rm -f $s ; nano $s 15 | bash /etc/inexistence/00.Installation/package/qbittorrent/configure -u $iUser -p $iPass -w 2017 -i 9002 16 | bash <(wget -qO- https://github.com/Aniverse/inexistence/raw/master/00.Installation/package/qbittorrent/configure) 17 | } 18 | 19 | ################################################################################################ Get options 20 | 21 | unset LogRootPath LogTimes DebLocation SCLocation LOCKLocation OutputLOG \ 22 | iUser iPass iHome wPort iPort lang 23 | 24 | AppName=qBittorrent 25 | AppNameLower=qbittorrent 26 | Need_SourceCode=no 27 | pm_action=configure 28 | 29 | function show_usage() { echo " 30 | $AppName $pm_action $script_version ($script_update) 31 | Usage: 32 | -u Username for qBittorrent 33 | -p Password for qBittorrent WebUI 34 | -h Specifiy user's home path 35 | -w WebUI port for qBittorrent 36 | -i Incoming port for qBittorrent 37 | -l language for qBittorrent WebUI 38 | -d Enable debug mode 39 | -f Force recover existing configuration 40 | --shared run this script without root privilege, this is for shared seedbox 41 | --log Show logfile's content" 42 | exit 1 ; } 43 | 44 | OPTS=$(getopt -a -o u:p:w:i:l:dhf --long "username:,password:,home:,wport:,iport:,lang:,logbase:,debug,shared,log,help,force" -- "$@") 45 | [ ! $? = 0 ] && show_usage 46 | eval set -- "$OPTS" 47 | while true; do 48 | case "$1" in 49 | -u | --username ) iUser="$2" ; shift 2 ;; 50 | -p | --password ) iPass="$2" ; shift 2 ;; 51 | -h | --home ) iHome="$2" ; shift 2 ;; 52 | -w | --wport ) wPort="$2" ; shift 2 ;; 53 | -i | --iport ) iPort="$2" ; shift 2 ;; 54 | -l | --lang ) lang="$2" ; shift 2 ;; 55 | -d | --debug ) debug=1 ; shift ;; 56 | -f | --force ) force=1 ; shift ;; 57 | -h | --help ) show_usage ; exit 0 ; shift ;; 58 | --log ) show_log=1 ; shift ;; 59 | --logbase ) LogTimes="$2" ; shift 2 ;; 60 | --shared ) shared=1 ; shift ;; 61 | -- ) shift 2 ; break ;; 62 | * ) break ;; 63 | esac 64 | done 65 | 66 | ################################################################################################ Set Variables 1 67 | 68 | if [[ -f /etc/inexistence/00.Installation/function ]]; then 69 | source /etc/inexistence/00.Installation/function 70 | else 71 | source <(wget --no-check-certificate -qO- https://github.com/Aniverse/inexistence/raw/master/00.Installation/function) 72 | fi 73 | 74 | set_variables_log_location 75 | check_var_OutputLOG 76 | debug_log_location 77 | cat_outputlog 78 | add_local_script_to_PATH 79 | check_var_iUser_iPass_iHome 80 | 81 | ################################################################################################ Set Variables 2 82 | 83 | [[ -z $wPort ]] && wPort=2017 84 | [[ -z $iPort ]] && iPort=9002 85 | [[ $lang == eng ]] && qbt_language=en 86 | [[ -z $qbt_language ]] && qbt_language=zh 87 | 88 | PortCheck $wPort $iPort 89 | [[ $port_used == 1 ]] && echo_error "Please change your port" && exit 1 90 | 91 | qb_installed_ver=$(qbittorrent-nox --version 2>&1 | awk '{print $2}' | grep -oE "[0-9.]+") 92 | qbconf="$iHome/.config/qBittorrent/qBittorrent.conf" 93 | 94 | ################################################################################################ 95 | 96 | function write_qbittorrent_nginx_reverse_proxy () { 97 | # Nginx Reverse 98 | # Currently this is only for the first non-root user 99 | if [[ -d /etc/nginx/apps ]] && [[ ! -f /etc/nginx/apps/qbittorrent.conf ]]; then 100 | cat << EOF > /etc/nginx/apps/qbittorrent.conf 101 | location /qb { 102 | return 301 https://\$host/qbittorrent/; 103 | } 104 | 105 | # https://github.com/qbittorrent/qBittorrent/wiki/NGINX-Reverse-Proxy-for-Web-UI 106 | location /qbittorrent/ { 107 | proxy_pass http://127.0.0.1:$wPort/; 108 | proxy_set_header X-Forwarded-Host \$server_name:\$server_port; 109 | proxy_hide_header Referer; 110 | proxy_hide_header Origin; 111 | proxy_set_header Referer ''; 112 | proxy_set_header Origin ''; 113 | add_header X-Frame-Options "SAMEORIGIN"; 114 | } 115 | EOF 116 | if [[ -d /opt/qBittorrent/WebUI/miniers.qb-web/public ]]; then 117 | sleep 0.1 118 | fi 119 | nginx -s reload >> "$OutputLOG" 2>&1 120 | fi 121 | } 122 | 123 | 124 | function write_qbittorrent_systemd () { 125 | cat << EOF > /etc/systemd/system/qbittorrent@.service 126 | [Unit] 127 | Description=qBittorrent Daemon Service 128 | After=network.target 129 | 130 | [Service] 131 | #UMask=000 132 | Type=forking 133 | User=%I 134 | LimitNOFILE=infinity 135 | ExecStart=/usr/bin/qbittorrent-nox -d 136 | ExecStop=/usr/bin/killall -s 9 /usr/bin/qbittorrent-nox 137 | Restart=on-failure 138 | #TimeoutSec=300 139 | 140 | [Install] 141 | WantedBy=multi-user.target 142 | EOF 143 | systemctl $systemctl_user_flag daemon-reload >> $OutputLOG 2>&1 144 | } 145 | 146 | 147 | function write_qbittorrent_conf () { 148 | # This is for users who still using qBittorrent older than 4.2.0 149 | # Therefore some qBittorrent-4.2-and-above-only settings are not added here 150 | cat << EOF > $qbconf 151 | [Application] 152 | FileLogger\Enabled=true 153 | FileLogger\Age=6 154 | FileLogger\DeleteOld=true 155 | FileLogger\Backup=true 156 | FileLogger\AgeType=1 157 | FileLogger\Path=$iHome/.config/qBittorrent 158 | FileLogger\MaxSize=20 159 | 160 | [BitTorrent] 161 | Session\AnnounceToAllTiers=true 162 | Session\AsyncIOThreadsCount=4 163 | Session\CheckingMemUsageSize=16 164 | Session\ChokingAlgorithm=FixedSlots 165 | Session\CoalesceReadWrite=false 166 | Session\FilePoolSize=40 167 | Session\GuidedReadCache=true 168 | Session\MultiConnectionsPerIp=false 169 | Session\SeedChokingAlgorithm=FastestUpload 170 | Session\SendBufferLowWatermark=10 171 | Session\SendBufferWatermark=500 172 | Session\SendBufferWatermarkFactor=50 173 | Session\SocketBacklogSize=30 174 | Session\SuggestMode=false 175 | Session\uTPMixedMode=TCP 176 | 177 | [LegalNotice] 178 | Accepted=true 179 | 180 | [Preferences] 181 | Advanced\AnnounceToAllTrackers=false 182 | Advanced\RecheckOnCompletion=false 183 | Advanced\osCache=true 184 | Advanced\trackerPort=9000 185 | Bittorrent\AddTrackers=false 186 | Bittorrent\DHT=false 187 | Bittorrent\Encryption=1 188 | Bittorrent\LSD=false 189 | Bittorrent\MaxConnecs=-1 190 | Bittorrent\MaxConnecsPerTorrent=-1 191 | Bittorrent\MaxRatioAction=0 192 | Bittorrent\PeX=false 193 | Bittorrent\uTP=false 194 | Bittorrent\uTP_rate_limited=true 195 | Connection\GlobalDLLimitAlt=0 196 | Connection\GlobalUPLimitAlt=0 197 | #Connection\InetAddress=1.1.1.1 198 | #Connection\Interface=eth0 199 | #Connection\InterfaceAddress=0.0.0.0 200 | #Connection\InterfaceName=eth0 201 | Connection\ResolvePeerCountries=true 202 | Connection\PortRangeMin=$iPort 203 | Downloads\DiskWriteCacheSize=64 204 | Downloads\DiskWriteCacheTTL=60 205 | Downloads\SavePath=$iHome/qbittorrent/download 206 | Downloads\SaveResumeDataInterval=3 207 | Downloads\ScanDirsV2=@Variant(\0\0\0\x1c\0\0\0\0) 208 | Downloads\StartInPause=false 209 | Downloads\TorrentExportDir=$iHome/qbittorrent/torrent 210 | General\Locale=$qbt_language 211 | Queueing\QueueingEnabled=false 212 | #Disable CSRF Protection For PT Plugin Plus 213 | WebUI\AlternativeUIEnabled=false 214 | WebUI\CSRFProtection=false 215 | WebUI\HostHeaderValidation=true 216 | WebUI\LocalHostAuth=false 217 | WebUI\Port=$wPort 218 | WebUI\RootFolder=/opt/qBittorrent/WebUI/CzBiX.qb-web 219 | 220 | EOF 221 | if [[ -z $(command -v qbpass) ]]; then 222 | wget --no-check-certificate -nv https://github.com/KozakaiAya/libqbpasswd/releases/download/v0.2/qb_password_gen_static -O /usr/local/bin/qbpass >> $OutputLOG 2>&1 223 | chmod +x /usr/local/bin/qbpass >> $OutputLOG 2>&1 224 | fi 225 | qbPassOld=$(echo -n $iPass | md5sum | cut -f1 -d ' ') 226 | qbPassNew=$(/usr/local/bin/qbpass $iPass) 227 | cat << EOF >> $qbconf 228 | WebUI\Username=$iUser 229 | WebUI\Password_ha1=@ByteArray($qbPassOld) 230 | WebUI\Password_PBKDF2="@ByteArray($qbPassNew)" 231 | EOF 232 | } 233 | 234 | 235 | 236 | ################################################################################################ 237 | 238 | 239 | 240 | function configure_qbittorrent() { 241 | 242 | echo >> $OutputLOG 243 | 244 | backup_old_config qBittorrent 245 | mkdir -p $iHome/qbittorrent/{download,torrent,watch} $iHome/.config/qBittorrent $local_script $PortLocation 246 | if [[ -f $local_packages/package/qbittorrent/qqbb ]]; then 247 | ln -s $local_packages/package/qbittorrent/qqbb $local_script/qqbb >> $OutputLOG 2>&1 248 | else 249 | wget -nv https://github.com/Aniverse/inexistence/raw/master/00.Installation/package/qbittorrent/qqbb -O $local_script/qqbb >> $OutputLOG 2>&1 250 | chmod +x $local_script/qqbb 251 | fi 252 | 253 | write_qbittorrent_systemd 254 | write_qbittorrent_conf 255 | write_qbittorrent_nginx_reverse_proxy 256 | 257 | chmod -R 755 $iHome/qbittorrent $iHome/.config/qBittorrent >> $OutputLOG 2>&1 258 | chown -R $iUser.$iUser $iHome/qbittorrent $iHome/.config/qBittorrent >> $OutputLOG 2>&1 259 | 260 | systemctl enable qbittorrent@$iUser >> $OutputLOG 2>&1 261 | systemctl start qbittorrent@$iUser >> $OutputLOG 2>&1 262 | [[ -d /var/www/h5ai/$iUser ]] && ln -s $iHome/qbittorrent/download /var/www/h5ai/$iUser/qbittorrent >> $OutputLOG 2>&1 263 | sleep 2 264 | 265 | # Setup watch folder via WebAPI 266 | if version_ge $qb_installed_ver 4.2.0 ; then 267 | curl -i --data 'json={"scan_dirs":{"'"${iHome}/qbittorrent/watch"'":1}}' http://localhost:${wPort}/api/v2/app/setPreferences >> $OutputLOG 2>&1 268 | else 269 | curl -i --data 'json={"scan_dirs":{"'"${iHome}/qbittorrent/watch"'":1}}' http://localhost:${wPort}/command/setPreferences >> $OutputLOG 2>&1 270 | fi 271 | sed -i "s|WebUI\\\LocalHostAuth.*|WebUI\\\LocalHostAuth=true|" $qbconf >> $OutputLOG 2>&1 # Turn on LocalHostAuth after setup watch folder 272 | if [[ ! -f ${iHome}/.config/qBittorrent/watched_folders.json ]]; then 273 | grep ScanDirsV2 $qbconf -q || echo_error "Failed to set monitored folder" 274 | fi 275 | 276 | echo $wPort > $PortLocation/$iUser.$AppNameLower 277 | systemctl restart qbittorrent@$iUser >> $OutputLOG 2>&1 278 | sleep 2 279 | systemctl status qbittorrent@$iUser >> $OutputLOG 2>&1 280 | 281 | status_lock=$AppName-c 282 | echo "status_lock=$status_lock" > /tmp/Variables 283 | rm -f /tmp/$status_lock.1.lock /tmp/$status_lock.2.lock 284 | ps --user $iUser | grep qbittorrent-nox -q && touch /tmp/$status_lock.1.lock || touch /tmp/$status_lock.2.lock 285 | echo >> $OutputLOG 286 | 287 | } 288 | 289 | 290 | 291 | if [[ -d $iHome/.config/qBittorrent ]] && [[ $force != 1 ]] ;then 292 | echo -e "Configuration for $iUser already exists, skip configuration ..." 293 | else 294 | echo_task "Configuring $AppName ..." 295 | configure_qbittorrent & spinner $! 296 | check_status $status_lock 297 | fi 298 | -------------------------------------------------------------------------------- /00.Installation/package/deluge/install: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # https://github.com/Aniverse/inexistence 4 | # Author: Aniverse 5 | 6 | script_update=2020.07.15 7 | script_version=r10007 8 | 9 | ################################################################################################ Debug 10 | 11 | usage_for_debug() { 12 | export local_packages=/etc/inexistence/00.Installation 13 | export s=$local_packages/package/deluge/configure 14 | rm -f $s ; nano $s 15 | bash /etc/inexistence/00.Installation/package/deluge/install -m deb -v 2.0.3 16 | bash <(wget -qO- https://github.com/Aniverse/inexistence/raw/master/00.Installation/package/deluge/install) 17 | } 18 | 19 | ################################################################################################ Get options 20 | 21 | unset LogBase LogTimes SCLocation DebLocation LogLocation LOCKLocation OutputLOG \ 22 | AppName AppNameLower Need_SourceCode pm_action \ 23 | version mode debug 24 | 25 | AppName=Deluge 26 | AppNameLower=deluge 27 | AppExec=/usr/bin/deluged 28 | DebName=deluge-all 29 | Need_SourceCode=yes 30 | pm_action=install 31 | 32 | function show_usage() { echo " 33 | $AppName $pm_action $script_version ($script_update) 34 | Usage: 35 | -v Specifiy which version to be installed 36 | -m Install mode, can only be specified as deb, source 37 | -l Specifiy LogBase 38 | -d Enable debug mode 39 | " 40 | exit 1 ; } 41 | 42 | OPTS=$(getopt -o v:l:m:d -al mode:,version:,debug,logbase:,log -- "$@") 43 | [ ! $? = 0 ] && show_usage 44 | eval set -- "$OPTS" 45 | 46 | while [ -n "$1" ] ; do case "$1" in 47 | -v | --version ) version="$2" ; shift 2 ;; 48 | -m | --mode ) mode="$2" ; shift 2 ;; 49 | -l | --logbase ) LogTimes="$2" ; shift 2 ;; 50 | -d | --debug ) debug=1 ; shift ;; 51 | --log ) show_log=1 ; shift ;; 52 | -- ) shift ; break ;; 53 | esac ; done 54 | 55 | ################################################################################################ Set Variables 1 56 | 57 | if [[ -f /etc/inexistence/00.Installation/function ]]; then 58 | source /etc/inexistence/00.Installation/function 59 | else 60 | source <(wget -qO- https://github.com/Aniverse/inexistence/raw/master/00.Installation/function) 61 | fi 62 | 63 | set_variables_log_location 64 | check_var_OutputLOG 65 | debug_log_location 66 | cat_outputlog 67 | 68 | script_pid=$$ 69 | trap 'exit 1' TERM 70 | 71 | ################################################################################################ 72 | 73 | DE_deb_available=('2.0.3') 74 | git_repo="https://github.com/deluge-torrent/deluge" 75 | py_lt_ver=$(python -c "import libtorrent ; print libtorrent.version" 2>&1 | grep -oE [0-9.]+) 76 | # lt_ver=$( pkg-config --exists --print-errors "libtorrent-rasterbar >= 3.0.0" 2>&1 | awk '{print $NF}' | grep -oE [0-9.]+ ) 77 | 78 | if [[ -n $version ]] && [[ $mode == source ]]; then 79 | check_remote_git_repo_branch $git_repo "deluge-$version" 80 | source_type=tarball 81 | elif [[ -n $branch ]]; then 82 | check_remote_git_repo_branch $git_repo "$branch" 83 | mode=source 84 | source_type=git 85 | elif [[ $mode == deb ]]; then 86 | if [[ $version != 2.0.3 ]]; then 87 | echo_warning "version changes to 2.0.3 since only this version is available" 88 | version=2.0.3 89 | elif [[ ! $CODENAME =~ (xenial|bionic|stretch) ]]; then 90 | echo_error_exit "deb mode is not available in $CODENAME" 91 | fi 92 | fi 93 | 94 | # need to check the version of python-libtorrent 95 | 96 | ################################################################################################ 97 | 98 | 99 | 100 | # python-libtorrent / python3-libtorrent will be installed from source or deb 101 | # https://dev.deluge-torrent.org/wiki/Installing/Source 102 | # https://deluge.readthedocs.io/en/latest/devguide/tutorials/01-setup.html 103 | # https://github.com/deluge-torrent/deluge/blob/develop/DEPENDS.md 104 | function install_deluge_dependencies() { 105 | lines2 >> $OutputLOG 106 | if [[ $deluge_major_version == 1 ]]; then 107 | apt_install_dependencies python python-openssl python-setuptools python-twisted python-xdg python-chardet \ 108 | python-mako python-pygame python-glade2 python-notify \ 109 | intltool librsvg2-common xdg-utils geoip-database 110 | elif [[ $deluge_major_version == 2 ]]; then 111 | apt_install_dependencies python3 python3-openssl python3-setuptools python3-twisted python3-xdg python3-chardet \ 112 | python3-mako python3-pygame \ 113 | intltool librsvg2-common xdg-utils geoip-database \ 114 | python3-setproctitle python3-rencode python3-pil python3-zope.interface 115 | # offical guides: python3-geoip python3-dbus python3-gi python3-gi-cairo gir1.2-gtk-3.0 gir1.2-appindicator3 libnotify4 116 | fi 117 | } 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | function fetch_source_codes() { 126 | cd $SCLocation 127 | if [[ $source_type == tarball ]]; then 128 | if version_ge $version 2.0 ; then 129 | wget http://download.deluge-torrent.org/source/2.0/deluge-$version.tar.xz -O deluge-$version.tar.xz >> $OutputLOG 2>&1 130 | else 131 | wget http://download.deluge-torrent.org/source/deluge-$version.tar.gz -O deluge-$version.tar.gz >> $OutputLOG 2>&1 132 | fi 133 | tar xf deluge-$version.tar* >> $OutputLOG 2>&1 134 | rm -f deluge-$version.tar* >> $OutputLOG 2>&1 135 | cd deluge-$version >> $OutputLOG 2>&1 || echo_error_exit "Failed to cd deluge source folder" 136 | elif [[ $source_type == git ]]; then 137 | git clone --depth=1 -b $branch https://github.com/deluge-torrent/deluge deluge-$version >> $OutputLOG 2>&1 138 | cd deluge-$version >> $OutputLOG 2>&1 || echo_error_exit "Failed to cd deluge source folder" 139 | # version=$(git describe | cut -d- -f2) 140 | sed -i 's/-dev//g' setup.cfg >> $OutputLOG 2>&1 141 | fi 142 | } 143 | 144 | 145 | 146 | 147 | 148 | function install_deluge_source() { 149 | fetch_source_codes 150 | python setup.py build >> $OutputLOG 2>&1 151 | python setup.py install --install-layout=deb --record $LogLocation/deluge.filelist.txt >> $OutputLOG 2>&1 152 | cd 153 | rm -rf deluge-$version 154 | } 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | function install_deluge_v2_deb() { 163 | 164 | lines2 >> $OutputLOG 165 | pip3 install --upgrade twisted[tls] 166 | list="deluge-common_2.0.3-1build1_all.deb 167 | deluge-console_2.0.3-1build1_all.deb 168 | deluge-gtk_2.0.3-1build1_all.deb 169 | deluge-web_2.0.3-1build1_all.deb 170 | deluged_2.0.3-1build1_all.deb" 171 | mkdir -p /tmp/de_deb 172 | cd /tmp/de_deb 173 | for deb in $list ; do 174 | wget -O $deb https://github.com/amefs/quickbox-files/raw/master/${CODENAME}/binary-amd64/deluge/$deb >> "$OutputLOG" 2>&1 175 | done 176 | wget https://github.com/amefs/quickbox-files/raw/master/$CODENAME/binary-amd64/libtorrent-rasterbar/python3-libtorrent_1.1.14-1build1_amd64.deb >> $OutputLOG 2>&1 177 | apt-get -y --allow-unauthenticated -f install ./*deb >> "$OutputLOG" 2>&1 178 | cd && rm -rf /tmp/de_deb 179 | apt-mark hold deluge-common deluge-console deluge-gtk deluge-web deluged >> "$OutputLOG" 2>&1 180 | } 181 | 182 | 183 | function check_status_de() { 184 | app_installed_ver=$(eval $AppExec --version | grep deluge | awk '{print $2}' | grep -oE "[0-9].[0-9]+.[0-9]+") 185 | if [[ -z $app_installed_ver ]]; then 186 | status_failed 187 | elif [[ $app_installed_ver == $version ]]; then 188 | status_done 189 | touch $LOCKLocation/$AppNameLower.lock 190 | status_done 191 | restart_app 192 | else 193 | echo_error2 "$app_installed_ver is installed rather than $version" 194 | fi 195 | } 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | case $mode in 204 | source ) if [[ ! -f $LOCKLocation/deluge.dependencies.lock ]]; then 205 | echo_task "Installing deluge build dependencies ..." 206 | install_deluge_dependencies & spinner $! 207 | check_status 208 | fi 209 | 210 | echo_task "Installing deluge ${bold}${cyan}$version${normal} from source codes ..." 211 | install_deluge_source & spinner $! 212 | check_status_de 213 | ;; 214 | deb ) echo_task "Installing deluge ${bold}${cyan}$version${normal} from pre-built deb ..." 215 | install_deluge_v2_deb & spinner $! 216 | check_status_de 217 | ;; 218 | esac 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | ###################### deprecated ###################### 229 | 230 | function deprecated_codes() { 231 | 232 | [[ $DESSL == Yes ]] && { deluge_old_version_ssl_fix && deluge_install_diff ; version_o=$version ; version=1.3.15 && fetch_source_codes ; } 233 | if [[ $DESSL == Yes ]]; then 234 | mv -f $SCLocation/deluge-$version_o-tmp/bin/deluged /usr/bin/deluged 235 | rm -rf deluge-$version ; version=$version_o 236 | rm -rf $DeTmpPath 237 | fi 238 | 239 | [[ $CODENAME != focal ]] /usr/local/bin/pip install --upgrade twisted pillow rencode pyopenssl >> $OutputLOG 2>&1 240 | 241 | # Check if input version is available 242 | DeSource="http://download.deluge-torrent.org/source" 243 | AvailableVersion=$( wget -qO- $DeSource | grep -o "deluge-[0-9]\{1,2\}\.[0-9]\{1,2\}\.[0-9]\{1,2\}\.tar.gz" | sort -uV | grep -o "[0-9]\{1,2\}\.[0-9]\{1,2\}\.[0-9]\{1,2\}" ) 244 | [[ -n $version ]] && [[ -z $( echo $AvailableVersion | grep $version ) ]] && { echo -e "\n${CW} The version you input is not available!\n" ; exit 1 ; } 245 | 246 | # Check if ssl issue should be fix 247 | version_ge $version 1.3.11 || DESSL=Yes 248 | 249 | # Check if libtorrent below 1.1.12 is supported 250 | version_ge $version 2.0 && export lt8_support=No || lt8_support=Yes 251 | [[ -n $py_lt_ver ]] && version_ge $lt_ver 1.1.3 && lt_ver_newer=Yes || lt_ver_newer=No 252 | [[ $lt8_support == No ]] && [[ $lt_ver_newer == No ]] && echo -e "\n${CW} libtorrent-rasterbar 1.1.3 and above is required when installing deluge 2.0 and above${normal}\n" && exit 1 253 | 254 | case $mode in 255 | apt ) echo -ne "Installing deluge ${bold}${cyan}$version${normal} from repository ..." | tee -a $OutputLOG ; install_deluge_apt & spinner $! 256 | ;; 257 | ppa ) echo -ne "Installing deluge ${bold}${cyan}$latest_stable${normal} from stable ppa ..." | tee -a $OutputLOG ; install_deluge_ppa & spinner $! 258 | ;; 259 | esac 260 | 261 | } 262 | 263 | # Install from repository 264 | function install_deluge_apt() { 265 | version=$( apt-cache policy deluge | grep -B1 http | grep -Eo "[012]\.[0-9]+.[0-9]+" | head -n1 ) 266 | if [[ -z $version ]]; then 267 | [[ $CODENAME == bionic ]] && version=1.3.15 ; [[ $CODENAME == xenial ]] && version=1.3.12 ; [[ $CODENAME == trusty ]] && version=1.3.6 268 | [[ $CODENAME == buster ]] && version=1.3.15 ; [[ $CODENAME == stretch ]] && version=1.3.13 ; [[ $CODENAME == jessie ]] && version=1.3.10 269 | fi 270 | apt-get install -y deluge deluged deluge-web deluge-console deluge-gtk >> $OutputLOG 2>&1 && touch /tmp/de.1.lock || touch /tmp/de.2.lock 271 | } 272 | 273 | # Install from PPA 274 | function install_deluge_ppa() { 275 | latest_stable=` wget -qO- https://dev.deluge-torrent.org/wiki/ReleaseNotes | grep wiki/ReleaseNotes | grep -Eo "[12]\.[0-9.]+" | sed 's/">/ /' | awk '{print $1}' | head -n1 ` 276 | [[ -z $latest_stable ]] && latest_stable=1.3.15 277 | if [[ $DISTRO == Debian ]]; then 278 | echo 'deb http://ppa.launchpad.net/deluge-team/ppa/ubuntu trusty main' >> /etc/apt/sources.list 279 | apt-get update >> $OutputLOG 2>&1 280 | apt-get install -t trusty deluge deluged deluge-web deluge-console deluge-gtk >> $OutputLOG 2>&1 && touch /tmp/de.1.lock || touch /tmp/de.2.lock 281 | elif [[ $DISTRO == Ubuntu ]]; then 282 | add-apt-repository -y ppa:deluge-team/ppa >> $OutputLOG 2>&1 283 | apt-get update >> $OutputLOG 2>&1 284 | # apt-get install python-libtorrent >> $OutputLOG 2>&1 285 | # apt-get install -y --allow-change-held-packages --allow-downgrades libtorrent-rasterbar8=1.0.11-1~xenial~ppa1.1 python-libtorrent=1.0.11-1~xenial~ppa1.1 >> $OutputLOG 2>&1 286 | # apt-mark hold python-libtorrent >> $OutputLOG 2>&1 287 | # apt-mark hold libtorrent-rasterbar8 >> $OutputLOG 2>&1 288 | apt-get install -t trusty deluge deluged deluge-web deluge-console deluge-gtk >> $OutputLOG 2>&1 && touch /tmp/de.1.lock || touch /tmp/de.2.lock 289 | fi 290 | } 291 | 292 | # Install another version of deluge (e.g. 1.3.9 for KeepFRDS) 293 | # Have bugs to be fixed 294 | function install_deluge_alt() { 295 | fetch_source_codes 296 | [[ $DESSL == Yes ]] && deluge_old_version_ssl_fix 297 | deluge_install_diff 298 | mv -f $SCLocation/deluge-$version-tmp/bin/deluged /usr/bin/deluged2 && touch /tmp/de.1.lock || touch /tmp/de.2.lock 299 | rm -rf $DeTmpPath 300 | } 301 | 302 | # Fix older deluged ssl issue 303 | function deluge_old_version_ssl_fix() { 304 | sed -i "s/SSL.SSLv3_METHOD/SSL.SSLv23_METHOD/g" deluge/core/rpcserver.py 305 | sed -i "/ ctx = SSL.Context(SSL.SSLv23_METHOD)/a\ ctx.set_options(SSL.OP_NO_SSLv2 & SSL.OP_NO_SSLv3)" deluge/core/rpcserver.py 306 | } 307 | 308 | # Install deluged to another path which is $SCLocation/deluge-$version-tmp/bin/deluged 309 | function deluge_install_diff() { 310 | DeTmpPath=$SCLocation/deluge-$version-tmp 311 | DeTmpPath2=$SCLocation/deluge-$version-tmp/lib/python2.7/site-packages 312 | mkdir -p $DeTmpPath2 313 | PYTHONPATH=$DeTmpPath2 python setup.py install --prefix=$DeTmpPath >> $OutputLOG 2>&1 314 | } 315 | -------------------------------------------------------------------------------- /00.Installation/package/flexget/configure: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # https://github.com/Aniverse/inexistence 4 | # Author: Aniverse 5 | # 6 | # Thanks to amefs 7 | 8 | script_update=2021.07.30 9 | script_version=r10020 10 | 11 | ################################################################################################ Debug 12 | 13 | usage_for_debug() { 14 | export local_repo_base=/etc/inexistence 15 | export local_packages=$local_repo_base/00.Installation 16 | export s=$local_packages/package/flexget/configure 17 | rm -f $s ; nano $s 18 | bash $s -w 6788 -u black -p 19 | bash <(wget -qO- https://github.com/Aniverse/inexistence/raw/master/00.Installation/package/flexget/configure) 20 | } 21 | 22 | ################################################################################################ Get options 23 | 24 | unset LogRootPath LogTimes DebLocation SCLocation LOCKLocation OutputLOG \ 25 | mode iUser iPass iHome wPort 26 | 27 | AppName=FlexGet 28 | AppNameLower=flexget 29 | Need_SourceCode=no 30 | pm_action=configure 31 | 32 | function show_usage() { echo " 33 | $AppName $pm_action $script_version ($script_update) 34 | Usage: 35 | -l Specifiy LogBase (Not log file) 36 | -w Specifiy FlexGet WebUI port 37 | -p Specifiy FlexGet WebUI password 38 | -d Enable debug mode 39 | -f Force recover existing configuration 40 | --log Show logfile's content" 41 | exit 1 ; } 42 | 43 | OPTS=$(getopt -a -o u:p:l:w:df --long user:,password:,debug,logbase:,wport:,system,single,log,force -- "$@") 44 | [ ! $? = 0 ] && show_usage 45 | eval set -- "$OPTS" 46 | 47 | while [ -n "$1" ] ; do case "$1" in 48 | -u | --user ) iUser="$2" ; shift 2 ;; 49 | -p | --password ) iPass="$2" ; shift 2 ;; 50 | -l | --logbase ) LogTimes="$2" ; shift 2 ;; 51 | -w | --wport ) wPort="$2" ; shift 2 ;; 52 | -d | --debug ) debug=1 ; shift ;; 53 | -f | --force ) force=1 ; shift ;; 54 | --system ) mode=system ; shift ;; 55 | --single ) mode=single ; shift ;; 56 | --log ) show_log=1 ; shift ;; 57 | -- ) shift ; break ;; 58 | esac ; done 59 | # -u and --system, --single is deprecated currently 60 | 61 | ################################################################################################ Set Variables 1 62 | 63 | if [[ -f /etc/inexistence/00.Installation/function ]]; then 64 | source /etc/inexistence/00.Installation/function 65 | else 66 | source <(wget -qO- https://github.com/Aniverse/inexistence/raw/master/00.Installation/function) 67 | fi 68 | 69 | set_variables_log_location 70 | check_var_OutputLOG 71 | debug_log_location 72 | cat_outputlog 73 | check_var_iUser_iPass_iHome 74 | 75 | ################################################################################################ Set Variables 2 76 | 77 | [[ -z $wPort ]] && wPort=9566 78 | PortCheck $wPort 79 | [[ $port_used == 1 ]] && echo_failed "Please change your port" && exit 1 80 | 81 | ################################################################################################ Sub Functions 82 | 83 | function write_flexget_nginx_reverse_proxy() { 84 | # Currently this is only for the first non-root user 85 | if [[ -d /etc/nginx/apps ]] && [[ ! -f /etc/nginx/apps/flexget.conf ]]; then 86 | cat << EOF > /etc/nginx/apps/flexget.conf 87 | location /fg { 88 | return 301 https://\$host/flexget; 89 | } 90 | location /flexget { 91 | proxy_pass http://127.0.0.1:$wPort/flexget/; 92 | } 93 | EOF 94 | nginx -s reload >> "$OutputLOG" 2>&1 95 | fi 96 | } 97 | 98 | function write_flexget_config_file() { 99 | get_clients_port 100 | [[ -z $qb_port ]] && qb_port=2017 101 | [[ -z $de_port ]] && de_port=58846 102 | [[ -z $tr_port ]] && tr_port=9099 103 | cat << EOF > /tmp/flexget.conf 104 | # Here are some guides 105 | # 106 | # https://ymgblog.com/2018/04/30/396/ 107 | # https://npchk.info/linux-flexget-rss/ 108 | # https://linkthis.me/2018/02/15/the-note-of-using-flexget/ 109 | # 110 | # https://github.com/Aniverse/WiKi/blob/master/Flexget.md 111 | # https://github.com/Aniverse/WiKi/blob/master/How.to.use.RSS.md#flexget-rss 112 | # 113 | # For more usages, check the offical site: https://flexget.com 114 | 115 | templates: 116 | standard: 117 | free_space: 118 | path: $iHome 119 | space: 10240 120 | seen: 121 | fields: 122 | - url 123 | de: 124 | deluge: 125 | path: $iHome/deluge/download/ 126 | host: localhost 127 | port: $de_port 128 | username: $iUser 129 | password: $iPass 130 | qb: 131 | qbittorrent: 132 | path: $iHome/qbittorrent/download/ 133 | host: localhost 134 | port: $qb_port 135 | username: $iUser 136 | password: $iPass 137 | tr: 138 | transmission: 139 | path: $iHome/transmission/download/ 140 | host: localhost 141 | port: $tr_port 142 | username: $iUser 143 | password: $iPass 144 | size: 145 | content_size: 146 | min: 6000 147 | max: 666666 148 | strict: no 149 | tasks: 150 | UHDBits-movie-remux: 151 | inputs: 152 | - limit: 153 | amount: 5 154 | from: 155 | rss: 156 | url: https://uhdbits.org/rss.php?action=rss&user=XXX&passkey=XXX&auth=XXX&authkey=XXX&feed=dl&freetorrent[]=1 157 | all_entries: no 158 | accept_all: yes 159 | if: 160 | - "'Remux' in title": accept 161 | - "'Season' in title": reject 162 | template: 163 | - standard 164 | - de 165 | content_size: 166 | min: 3000 167 | max: 28000 168 | strict: no 169 | CinemaGeddon: 170 | rss: 171 | url: http://cinemageddon.net/rss.xml 172 | ascii: yes 173 | headers: 174 | Cookie: "__cfduid=abcd123456789; uid=12450; pass=mickeynb" 175 | accept_all: yes 176 | template: qb 177 | qbittorrent: 178 | label: CG 179 | maxdownspeed: 30000 180 | 181 | web_server: 182 | port: $wPort 183 | web_ui: yes 184 | # base_url: /flexget 185 | 186 | # schedules is disabled by default, you need to enable it or use cron to RSS 187 | schedules: no 188 | 189 | EOF 190 | cp -f /tmp/flexget.conf $iHome/.config/flexget/config.yml 191 | } 192 | 193 | 194 | function write_flexget_systemd() { 195 | cat << EOF > /etc/systemd/system/flexget@.service 196 | [Unit] 197 | Description=Flexget Daemon 198 | After=network.target 199 | 200 | [Service] 201 | Type=simple 202 | User=%I 203 | UMask=000 204 | ExecStart=$flexget_cmd -c /home/%i/.config/flexget/config.yml daemon start 205 | ExecStartPre=/bin/rm -f /home/%i/.config/flexget/.config-lock 206 | ExecStop=$flexget_cmd -c /home/%i/.config/flexget/config.yml daemon stop 207 | ExecReload=$flexget_cmd -c /home/%i/.config/flexget/config.yml daemon reload 208 | TimeoutStartSec=10 209 | TimeoutStopSec=5 210 | 211 | #Group=%I 212 | #WorkingDirectory=/home/%i/.config/flexget/ 213 | #Restart=on-failure 214 | 215 | [Install] 216 | WantedBy=multi-user.target 217 | EOF 218 | systemctl daemon-reload 219 | } 220 | 221 | 222 | function get_flexget_plugins() { 223 | if [[ ! -d $inexistence_files/flexget-plugins ]]; then 224 | mkdir -p $inexistence_files/flexget-plugins 225 | cd $inexistence_files/flexget-plugins 226 | # https://github.com/Juszoe/flexget-nexusphp 227 | wget https://github.com/Juszoe/flexget-nexusphp/releases/latest/download/nexusphp.py -O nexusphp.py >> "$OutputLOG" 2>&1 228 | 229 | # https://github.com/IvonWei/flexget_qbittorrent_mod 230 | # wget https://github.com/IvonWei/flexget_qbittorrent_mod/releases/latest/download/dist.zip -O dist.zip >> "$OutputLOG" 2>&1 231 | # unzip dist.zip -d tmp >> "$OutputLOG" 2>&1 232 | # cp -rf tmp/* . >> "$OutputLOG" 2>&1 233 | # rm -rf tmp dist.zip >> "$OutputLOG" 2>&1 234 | fi 235 | } 236 | 237 | 238 | function add_flexget_plugins() { 239 | mkdir -p $iHome/.config/flexget/plugins 240 | cd $iHome/.config/flexget/plugins 241 | cp -rf $inexistence_files/flexget-plugins/* . >> $OutputLOG 2>&1 242 | } 243 | 244 | 245 | ################################################################################################ Main Function 246 | 247 | 248 | 249 | 250 | 251 | function configure_flexget() { 252 | 253 | echo >> $OutputLOG 254 | systemctl disable flexget@$iUser >> "$OutputLOG" 2>&1 255 | systemctl stop flexget@$iUser >> "$OutputLOG" 2>&1 256 | 257 | backup_old_config flexget 258 | mkdir -p /$iHome/.config/flexget $PortLocation # $iHome/{transmission,qbittorrent,deluge}/{download,watch} 259 | echo $wPort > $PortLocation/$iUser.$AppNameLower 260 | flexget_cmd=/usr/local/bin/flexget 261 | write_flexget_config_file 262 | write_flexget_systemd 263 | write_flexget_nginx_reverse_proxy 264 | get_flexget_plugins 265 | add_flexget_plugins 266 | 267 | chown $iUser.$iUser -R $iHome/.config/flexget/ >> "$OutputLOG" 2>&1 268 | # $flexget_cmd -c $iHome/.config/flexget/config.yml web passwd $iPass >> "$OutputLOG" 2>&1 269 | su $iUser -c "$flexget_cmd -c $iHome/.config/flexget/config.yml web passwd $iPass" >> "$OutputLOG" 2>&1 270 | 271 | systemctl enable flexget@$iUser >> "$OutputLOG" 2>&1 272 | systemctl start flexget@$iUser >> "$OutputLOG" 2>&1 273 | 274 | status_lock=$AppNameLower-c 275 | echo "status_lock=$status_lock" > /tmp/Variables 276 | rm -f /tmp/$status_lock.1.lock /tmp/$status_lock.2.lock 277 | ps --user $iUser | grep flexget -q && touch /tmp/$status_lock.1.lock || touch /tmp/$status_lock.2.lock 278 | echo >> $OutputLOG 279 | 280 | } 281 | 282 | 283 | 284 | 285 | if [[ -d $iHome/.config/flexget ]] && [[ $force != 1 ]] ;then 286 | echo -e "Configuration for $iUser already exists, skip configuration ..." 287 | else 288 | echo_task "Configuring $AppName ..." 289 | configure_flexget & spinner $! 290 | check_status $status_lock 291 | fi 292 | 293 | 294 | 295 | ################################################################################################ Deprecated 296 | 297 | 298 | 299 | 300 | 301 | function configure_flexget_old() { 302 | 303 | echo >> $OutputLOG 304 | systemctl disable flexget@$iUser >> "$OutputLOG" 2>&1 305 | systemctl stop flexget@$iUser >> "$OutputLOG" 2>&1 306 | 307 | if [[ -d $iHome/.config/flexget ]]; then 308 | mv -f $iHome/.config/flexget $iHome/.config/flexget.old.$times >> "$OutputLOG" 2>&1 309 | rm -rf mv $iHome/.config/flexget 310 | fi 311 | 312 | mkdir -p /$iHome/.config/flexget # /home/$iUser/{transmission,qbittorrent,deluge}/{download,watch} 313 | flexget_config_file 314 | 315 | if [[ $mode == system ]]; then 316 | flexget_cmd=/usr/local/bin/flexget 317 | flexget_systemd 318 | pypath=/usr/local/lib/python2.7/dist-packages 319 | flexget_username_patch 320 | elif [[ $mode == single ]]; then 321 | flexget_cmd=$iHome/.local/bin/flexget 322 | flexget_systemd 323 | pypath=$iHome/.local/lib/python2.7/site-packages 324 | flexget_username_patch 325 | fi 326 | 327 | $flexget_cmd -c $iHome/.config/flexget/config.yml web passwd $iPass >> "$OutputLOG" 2>&1 328 | chown $iUser.$iUser -R $iHome/.config/flexget/ >> "$OutputLOG" 2>&1 329 | systemctl enable flexget@$iUser >> "$OutputLOG" 2>&1 330 | systemctl start flexget@$iUser >> "$OutputLOG" 2>&1 331 | 332 | status_lock=$AppNameLower-c 333 | echo "status_lock=$status_lock" > /tmp/Variables 334 | rm -f /tmp/$status_lock.1.lock /tmp/$status_lock.2.lock 335 | ps --user $iUser | grep flexget -q && touch /tmp/$status_lock.1.lock || touch /tmp/$status_lock.2.lock 336 | echo >> $OutputLOG 337 | 338 | } 339 | 340 | 341 | 342 | function flexget_systemd_old() { 343 | cat << EOF > /etc/systemd/system/flexget@.service 344 | [Unit] 345 | Description=Flexget Daemon 346 | After=network.target 347 | 348 | [Service] 349 | Type=simple 350 | User=%I 351 | UMask=000 352 | ExecStart=$flexget_cmd -c /home/%i/.config/flexget/config.yml daemon start 353 | ExecStartPre=/bin/rm -f /home/%i/.config/flexget/.config-lock 354 | ExecStop=/usr/bin/pkill -9 flexget 355 | ExecReload=$flexget_cmd -c /home/%i/.config/flexget/config.yml daemon reload 356 | TimeoutStartSec=10 357 | TimeoutStopSec=5 358 | 359 | #Group=%I 360 | #WorkingDirectory=/home/%i/.config/flexget/ 361 | #Restart=on-failure 362 | #ExecStop=$flexget_cmd -c /home/%i/.config/flexget/config.yml daemon stop 363 | 364 | [Install] 365 | WantedBy=multi-user.target 366 | EOF 367 | systemctl daemon-reload 368 | } 369 | 370 | 371 | 372 | function flexget_systemd_old() { 373 | cat << EOF > /etc/systemd/system/flexget@.service 374 | [Unit] 375 | Description=Flexget Daemon 376 | After=network.target 377 | 378 | [Service] 379 | Type=simple 380 | User=%I 381 | UMask=000 382 | ExecStart=$flexget_cmd -c /home/%i/.config/flexget/config.yml daemon start 383 | ExecStartPre=/bin/rm -f /home/%i/.config/flexget/.config-lock 384 | ExecStop=/usr/bin/pkill -9 flexget 385 | ExecReload=$flexget_cmd -c /home/%i/.config/flexget/config.yml daemon reload 386 | TimeoutStartSec=10 387 | TimeoutStopSec=5 388 | 389 | #Group=%I 390 | #WorkingDirectory=/home/%i/.config/flexget/ 391 | #Restart=on-failure 392 | #ExecStop=$flexget_cmd -c /home/%i/.config/flexget/config.yml daemon stop 393 | 394 | [Install] 395 | WantedBy=multi-user.target 396 | EOF 397 | systemctl daemon-reload 398 | } 399 | 400 | 401 | 402 | function flexget_username_patch() { 403 | cd /tmp 404 | if [[ -f $local_packages/package/flexget/flexget-user-passwd.patch ]]; then 405 | cp $local_packages/package/flexget/flexget-user-passwd.patch /tmp/flexget-user-passwd.patch 406 | else 407 | wget -qO /tmp/flexget-user-passwd.patch https://github.com/Aniverse/inexistence/raw/master/00.Installation/package/flexget/flexget-user-passwd.patch 408 | fi 409 | sed -i "s/replace/${iUser}/g" /tmp/flexget-user-passwd.patch 410 | patch -p1 -d ${pypath}/flexget/ < /tmp/flexget-user-passwd.patch >> "$OutputLOG" 2>&1 411 | python2 -m compileall ${pypath}/flexget/webserver.py >> "$OutputLOG" 2>&1 412 | sed -i "s/\\\'flexget\\\'/\\\'\\\'/g" ${pypath}/flexget/ui/v1/app/scripts/app.js 413 | rm -rf /tmp/flexget-user-passwd.patch 414 | } 415 | -------------------------------------------------------------------------------- /00.Installation/s-alias: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # https://github.com/Aniverse/inexistence 4 | # Author: Aniverse 5 | # 6 | # script_update=2020.09.01 7 | # script_version=r12023 8 | # This var will recover other script's var when source 9 | ################## Inexistence Mod Start ################## 10 | 11 | function setcolor() { 12 | black=$(tput setaf 0); red=$(tput setaf 1) ; green=$(tput setaf 2); yellow=$(tput setaf 3); bold=$(tput bold) ; jiacu=${normal}${bold} 13 | blue=$(tput setaf 4) ; magenta=$(tput setaf 5); cyan=$(tput setaf 6) ; white=$(tput setaf 7) ; normal=$(tput sgr0) 14 | on_black=$(tput setab 0); on_red=$(tput setab 1) ; on_green=$(tput setab 2); on_yellow=$(tput setab 3) 15 | on_blue=$(tput setab 4) ; on_magenta=$(tput setab 5); on_cyan=$(tput setab 6) ; on_white=$(tput setab 7) 16 | shanshuo=$(tput blink) ; wuguangbiao=$(tput civis) ; guangbiao=$(tput cnorm) 17 | underline=$(tput smul) ; reset_underline=$(tput rmul) ; dim=$(tput dim) 18 | standout=$(tput smso) ; reset_standout=$(tput rmso) ; title=${standout} 19 | baihuangse=${white}${on_yellow}; bailanse=${white}${on_blue} ; bailvse=${white}${on_green} 20 | baiqingse=${white}${on_cyan} ; baihongse=${white}${on_red} ; baizise=${white}${on_magenta} 21 | heibaise=${black}${on_white} ; heihuangse=${on_yellow}${black} 22 | } 23 | 24 | function gggclone(){ git clone --depth=1 $1 && cd $(echo ${1##*/}) ;} 25 | function io_test() { (LANG=C dd if=/dev/zero of=test_$$ bs=64k count=16k conv=fdatasync && rm -f test_$$ ) 2>&1 | awk -F, '{io=$NF} END { print io}' | sed 's/^[ \t]*//;s/[ \t]*$//' ; } 26 | function iotest() { echo 27 | io1=$( io_test ) ; echo -e "${bold}硬盘 I/O (第一次测试) : ${yellow}$io1${normal}" 28 | io2=$( io_test ) ; echo -e "${bold}硬盘 I/O (第二次测试) : ${yellow}$io2${normal}" 29 | io3=$( io_test ) ; echo -e "${bold}硬盘 I/O (第三次测试) : ${yellow}$io3${normal}\n" 30 | } 31 | 32 | # Find a file with a pattern in name: 33 | function ff() { find . -type f -iname '*'"$*"'*' -ls ; } 34 | 35 | # Find a file with pattern $1 in name and Execute $2 on it: 36 | function fe() { find . -type f -iname '*'"${1:-}"'*' -exec ${2:-file} {} \; ; } 37 | 38 | # Find a pattern in a set of files and highlight them: 39 | #+ (needs a recent version of egrep). 40 | function fstr(){ 41 | OPTIND=1 42 | local mycase="" 43 | local usage="fstr: find string in files. 44 | Usage: fstr [-i] \"pattern\" [\"filename pattern\"] " 45 | while getopts :it opt 46 | do 47 | case "$opt" in 48 | i) mycase="-i " ;; 49 | *) echo "$usage"; return ;; 50 | esac 51 | done 52 | shift $(( $OPTIND - 1 )) 53 | if [ "$#" -lt 1 ]; then 54 | echo "$usage" 55 | return; 56 | fi 57 | find . -type f -name "${2:-*}" -print0 | \ 58 | xargs -0 egrep --color=always -sn ${case} "$1" 2>&- | more 59 | } 60 | 61 | function jieya() { 62 | file=$1 63 | delete=$2 64 | if [ -f $file ] ; then 65 | case $1 in 66 | *.tar.bz2) tar xvjf $1 ;; 67 | *.tar.gz) tar xvzf $1 ;; 68 | *.tar.xz) xz -d $1 ; 69 | tar xvf ${file%.*} ;; 70 | *.bz2) bunzip2 $1 ;; 71 | *.rar) unrar x $1 ;; 72 | *.gz) gunzip $1 ;; 73 | *.tar) tar xvf $1 ;; 74 | *.tbz2) tar xvjf $1 ;; 75 | *.tgz) tar xvzf $1 ;; 76 | *.zip) unzip $1 ;; 77 | *.Z) uncompress $1 ;; 78 | *.7z) 7z x $1 ;; 79 | *) echo "'$1' cannot be extracted via jieya" ;; 80 | esac 81 | [[ $delete == d ]] && rm -f $file ${file%.*} 82 | else 83 | echo "'$1' is not a valid file!" 84 | fi 85 | } 86 | 87 | function chaip() { 88 | local ipv4=$1 89 | echo $ipv4 | grep -qE '^[0-9][0-9]?[0-9]?\.[0-9][0-9]?[0-9]?\.[0-9][0-9]?[0-9]?\.[0-9][0-9]?[0-9]?$' || { echo "Error: Not valid IPv4" ; exit 1 ; } 90 | mkdir -p $HOME/.abench 91 | wget --no-check-certificate -t1 -T6 -qO- https://ipapi.co/$ipv4/json > $HOME/.abench/ipapi 2>&1 92 | ccoodde=$( cat $HOME/.abench/ipapi | grep \"country\" | awk -F '"' '{print $4}' ) 2>/dev/null 93 | country=$( cat $HOME/.abench/ipapi | grep \"country_name\" | awk -F '"' '{print $4}' ) 2>/dev/null 94 | regionn=$( cat $HOME/.abench/ipapi | grep \"region\" | awk -F '"' '{print $4}' ) 2>/dev/null 95 | cityyyy=$( cat $HOME/.abench/ipapi | grep \"city\" | awk -F '"' '{print $4}' ) 2>/dev/null 96 | isppppp=$( cat $HOME/.abench/ipapi | grep \"org\" | awk -F '"' '{print $4}' ) 2>/dev/null 97 | asnnnnn=$( cat $HOME/.abench/ipapi | grep \"asn\" | awk -F '"' '{print $4}' ) 2>/dev/null 98 | [[ $cityyyy == Singapore ]] && unset cityyyy 99 | [[ -z $isppppp ]] && isp="No ISP detected" 100 | [[ -z $asnnnnn ]] && isp="No ASN detected" 101 | rm -f $HOME/.abench/ipapi 2>&1 102 | echo -e "$ipv4" 103 | echo -e "$asnnnnn, $isppppp" 104 | echo -e "$country, $regionn, $cityyyy" 105 | } 106 | 107 | # Creates an archive (*.tar.gz) from given directory. 108 | function make-tar() { tar cvzf "${1%%/}.tar.gz" "${1%%/}/"; } 109 | 110 | # Create a ZIP archive of a file or folder. 111 | function make-zip() { zip -r "${1%%/}.zip" "$1" ; } 112 | 113 | function dabao() { 114 | local target=$1 115 | if [[ -d "$target" ]];then 116 | folder_size=$(du -sB MiB $target | awk '{print $1}' | grep -oE "[0-9]+") 117 | echo -e "\033[0;33m目标文件夹大小 $folder_size MiB\033[0m" 118 | [[ $folder_size -ge 200 ]] && read -p "确定打包么?" 119 | mkdir -p $HOME/tars 120 | target_full_path=$(cd $target;pwd) 121 | dirpath=$(dirname $target_full_path) 122 | target=$(basename $target_full_path) 123 | output=$target 124 | echo $target | grep -qE "^." && output=$(echo $target | sed "s/\.//") 125 | tarfile=$HOME/tars/$output.tar.gz 126 | [[ -e $tarfile ]] && echo -ne "\033[0;31m同名压缩包已存在" && rm -f $tarfile && echo -e ",删除之\033[0m" 127 | tar zcf $tarfile -C $dirpath $target && echo -ne "\033[0;32m打包后体积 " && du -sB KiB $tarfile | awk '{print $1}' 128 | echo -e "\033[0;34msz $tarfile\033[0m\n" 129 | else 130 | echo "\033[0;31m不是文件夹\033[0m" 131 | fi 132 | } 133 | 134 | if (! export | grep -q sbin); then 135 | export PATH=$PATH:/usr/local/sbin:/usr/sbin:/sbin 136 | fi 137 | 138 | newpass() { perl -le 'print map {(a..z,A..Z,0..9)[rand 62] } 0..pop' 15 ; } 139 | sprunge.us() { curl -F 'sprunge=<-' http://sprunge.us ; } 140 | lines() { printf "%-100s\n" "-" | sed 's/\s/-/g' ; } 141 | 142 | #ulimit -SHn 999999 143 | 144 | ################## Personal Alias Start ################## 145 | 146 | export LC_ALL=en_US.UTF-8 147 | export LANG=en_US.UTF-8 148 | export LANGUAGE=en_US.UTF-8 149 | export repo="https://github.com/Aniverse/inexistence" 150 | export local_repo_base=/etc/inexistence 151 | export local_packages=/etc/inexistence/00.Installation 152 | export local_script=/usr/local/bin/abox 153 | 154 | alias qba="systemctl start qbittorrent@iUser" 155 | alias qbb="systemctl stop qbittorrent@iUser" 156 | alias qbc="systemctl status qbittorrent@iUser" 157 | alias qbr="systemctl restart qbittorrent@iUser" 158 | alias qbl="tail -300 /home/iUser/.config/qBittorrent/qbittorrent.log" 159 | alias qbs="nano +40 /home/iUser/.config/qBittorrent/qBittorrent.conf" 160 | alias dea="systemctl start deluged@iUser" 161 | alias deb="systemctl stop deluged@iUser" 162 | alias dec="systemctl status deluged@iUser" 163 | alias der="systemctl restart deluged@iUser" 164 | alias del="grep -Ev 'TotalTraffic|Successfully loaded|Saving the state|Saving the fastresume|connection made from: 127.0.0.1|non-clean fashion' /home/iUser/.config/deluge/deluged.log | tail -300" 165 | alias dwa="systemctl start deluge-web@iUser" 166 | alias dwb="systemctl stop deluge-web@iUser" 167 | alias dwc="systemctl status deluge-web@iUser" 168 | alias dwr="systemctl restart deluge-web@iUser" 169 | alias dwl="tail -200 /home/iUser/.config/deluge/deluge-web.log" 170 | alias tra="systemctl start transmission@iUser" 171 | alias trb="systemctl stop transmission@iUser" 172 | alias trc="systemctl status transmission@iUser" 173 | alias trr="systemctl restart transmission@iUser" 174 | alias trl="tail -200 /home/iUser/.config/transmission-daemon/transmission.log" 175 | alias rta="su iUser -c 'rt start'" 176 | alias rtb="su iUser -c 'rt -k stop'" 177 | alias rtc="su iUser -c 'rt'" 178 | alias rtr="su iUser -c 'rt -k restart'" 179 | alias rtscreen="chmod -R 777 /dev/pts && su iUser -c 'screen -r rtorrent'" 180 | alias irssia="su iUser -c 'rt -i start'" 181 | alias irssib="su iUser -c 'rt -i -k stop'" 182 | alias irssic="su iUser -c 'rt -i'" 183 | alias irssir="su iUser -c 'rt -i -k restart'" 184 | alias irssiscreen="chmod -R 777 /dev/pts && su iUser -c 'screen -r irssi'" 185 | alias fga="systemctl start flexget@iUser" 186 | alias fgb="systemctl stop flexget@iUser" 187 | alias fgc="systemctl status flexget@iUser" 188 | alias fgr="systemctl restart flexget@iUser" 189 | alias fgaa="runuser -l iUser -c 'flexget daemon start --daemonize'" 190 | alias fgcc="runuser -l iUser -c 'flexget daemon status'" 191 | alias fgrr="runuser -l iUser -c 'flexget daemon reload-config'" 192 | alias fgcheck="runuser -l iUser -c 'flexget check'" 193 | alias fge="runuser -l iUser -c 'flexget execute'" 194 | alias fgl="echo ; tail -300 /home/iUser/.config/flexget/flexget.log ; echo" 195 | alias fgs="nano +60 /home/iUser/.config/flexget/config.yml" 196 | alias fla="systemctl start flood" 197 | alias flb="systemctl stop flood" 198 | alias flc="systemctl status flood" 199 | alias flr="systemctl restart flood" 200 | alias sssa="/appex/bin/serverSpeeder.sh start" 201 | alias sssb="/appex/bin/serverSpeeder.sh stop" 202 | alias sssc="/appex/bin/serverSpeeder.sh status" 203 | alias sssr="/appex/bin/serverSpeeder.sh restart" 204 | alias ssss="nano +60 /etc/serverSpeeder.conf" 205 | alias lssa="/appex/bin/lotServer.sh start" 206 | alias lssb="/appex/bin/lotServer.sh stop" 207 | alias lssc="/appex/bin/lotServer.sh status" 208 | alias lssr="/appex/bin/lotServer.sh restart" 209 | alias lsss="nano +60 /appex/etc/config" 210 | alias nginxr="/etc/init.d/nginx restart" 211 | 212 | alias yongle="du -sB GiB" 213 | alias yongle2="du -sB MiB" 214 | alias rtyongle="du -sB GiB /home/iUser/rtorrent/download" 215 | alias qbyongle="du -sB GiB /home/iUser/qbittorrent/download" 216 | alias deyongle="du -sB GiB /home/iUser/deluge/download" 217 | alias tryongle="du -sB GiB /home/iUser/transmission/download" 218 | alias cdde="cd /home/iUser/deluge/download" 219 | alias cdqb="cd /home/iUser/qbittorrent/download" 220 | alias cdrt="cd /home/iUser/rtorrent/download" 221 | alias cdtr="cd /home/iUser/transmission/download" 222 | alias cdin="cd /etc/inexistence/" 223 | alias cdrut="cd /var/www/rutorrent" 224 | 225 | alias rclonec='echo;echo q | rclone config | grep -Ev ".*\)|e/.*"' 226 | alias scrgd="screen -U -R GoogleDrive" 227 | alias scrgda="screen -U -r -d GoogleDrive" 228 | alias scrgdb="screen -S GoogleDrive -X quit" 229 | function scrb(){ screen -S $1 -X quit ;} 230 | 231 | alias dddd='rm -rf' 232 | alias ..='cd ..' 233 | alias path='echo -e ${PATH//:/\\n}' 234 | alias libpath='echo -e ${LD_LIBRARY_PATH//:/\n}' 235 | alias dh='df -kTh' 236 | alias aatop="TERM=st atop 1" 237 | alias px="ps aux | grep -v grep | grep" 238 | alias tree="tree --dirsfirst" 239 | alias l="ls -hAv --color --group-directories-first" 240 | alias ll="ls -hAlvZ --color --group-directories-first" 241 | alias ios="iostat -dxm 1" 242 | alias vms="vmstat 1 10" 243 | alias vns="vnstat -l" 244 | alias vnss="vnstat -m ; vnstat -d" 245 | alias vnsa="systemctl start vnstat" 246 | alias vnsb="systemctl stop vnstat" 247 | alias vnsc="systemctl status vnstat" 248 | alias vnsr="systemctl restart vnstat" 249 | 250 | alias abench="bash <(wget -qO- https://github.com/Aniverse/A/raw/i/a)" 251 | alias bench.sh="wget -qO- bench.sh | bash" 252 | alias fiobench="bash <(wget -qO- https://github.com/amefs/fio-bench/raw/master/fio-bench_zh-cn.sh -o /dev/null)" 253 | 254 | alias sousuo="find / -name" 255 | alias sousuo2="find /home/iUser -name" 256 | alias swapon="dd if=/dev/zero of=/etc/.swapfile bs=1M count=2048;mkswap /etc/.swapfile;swapon /etc/.swapfile;swapon -s" 257 | alias swapoff="swapoff /etc/.swapfile;rm -f /etc/.swapfile" 258 | 259 | alias yuan="nano +20 /etc/apt/sources.list" 260 | alias sshr="sed -i '/.*AllowGroups.*/d' /etc/ssh/sshd_config ; sed -i '/.*PasswordAuthentication.*/d' /etc/ssh/sshd_config ; sed -i '/.*PermitRootLogin.*/d' /etc/ssh/sshd_config ; echo 'PermitRootLogin yes' >> /etc/ssh/sshd_config ; /etc/init.d/ssh restart >/dev/null 2>&1 && echo -e '\n已开启 root 登陆\n'" 261 | 262 | alias s-opt="echo && cat /log/inexistence/installed.log && echo" 263 | alias s-end="echo && cat /log/inexistence/end.log" 264 | 265 | function s-log() { 266 | local logfile=$(cat /tmp/current.logfile 2>/dev/null) 267 | if [[ ! -f /tmp/current.logfile ]] ; then 268 | echo -e "/tmp/current.logfile does not exist" 269 | elif [[ ! -f $logfile ]]; then 270 | echo -e "$logfile does not exist" 271 | elif [[ -f $logfile ]]; then 272 | echo -e "\n${yellow}$logfile${normal}" ; lines 273 | tail -f $logfile 274 | fi 275 | } 276 | 277 | function s-debug() { 278 | source /etc/inexistence/00.Installation/function 279 | source /etc/inexistence/00.Installation/check-sys 280 | set_log_when_there_is_none 281 | } 282 | 283 | function s-info() { 284 | local more=$1 285 | source /etc/inexistence/00.Installation/function 286 | source /etc/inexistence/00.Installation/check-sys 287 | export_inexistence_info 288 | rm -f /tmp/.cpu.tmp 289 | [[ $more == hw ]] && hardware_check_1 && 290 | echo -n " 291 | CPU $CPUNum$cname (${cpucores}C${cputhreads}T) 292 | RAM $tram MB ($uram MB Used) 293 | Disk $disk_total_size GB ($disk_used_size GB Used)" > /tmp/.cpu.tmp 294 | echo "$(cat /tmp/.cpu.tmp 2>/dev/null) 295 | OS $displayOS 296 | Kernel $running_kernel 297 | Virtual $virtual 298 | 299 | IPv4 $serveripv4 300 | IPv6 $serveripv6 301 | Interface $interface 302 | 303 | Master User $(cat /log/inexistence/info/installed.user.list.txt 2>/dev/null | head -1) 304 | Password $iPass 305 | User's config $iHome/.config 306 | 307 | LogBase $LogBase 308 | local_repo $local_repo 309 | local_script $local_script 310 | local_packages $local_packages 311 | inexistence_files $inexistence_files 312 | 313 | network files /etc/network/interfaces 314 | /etc/netplan/01-netcfg.yaml 315 | apt sources /etc/apt/sources.list 316 | " 317 | } 318 | 319 | ################## Personal Alias END ################## 320 | 321 | # setcolor 322 | 323 | # Custom History Format 324 | HISTFILESIZE=4000 325 | HISTSIZE=4000 326 | # export HISTTIMEFORMAT="${yellow}[%F]${cyan}[%T]${normal} " 327 | export HISTTIMEFORMAT="$(tput setaf 3)[%F]$(tput setaf 6)[%T]$(tput sgr0) " 328 | 329 | # Disable mail check/warning 330 | shopt -u mailwarn 331 | unset MAILCHECK 332 | 333 | if [[ $1 == 1 ]];then 334 | echo -e "\n${green}Customed alias is enabled${normal}\n" 335 | fi 336 | 337 | ################## Inexistence Mod END ################## 338 | 339 | deprecated_function_alias() { 340 | sed -i -n -e :a -e '1,100!{P;N;D;};N;ba' /etc/bash.bashrc 341 | sed "/#\!\/bin\/bash/"d /usr/local/bin/s-alias >> /etc/bash.bashrc 342 | while grep -q "Inexistence Mod" /etc/bash.bashrc ; do sed -i '$d' /etc/bash.bashrc ; done 343 | 344 | s=/etc/inexistence/00.Installation/s-alias;rm -f $s ; nano $s 345 | } 346 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Inexistence 2 | 3 | > This is a seedbox script focus on Chinese users, I would prefer [QuickBox Lite](https://github.com/amefs/quickbox-lite), [swizzin](https://swizzin.ltd) for non-Chinese users. 4 | > Just a SEEDBOX script, no Plex, no Emby, no NZB support. 5 | > And note that this README is outdated, I'm too lazy to keep it update. 6 | 7 | ## 2021.07.30 说明 8 | 9 | 目前本人基本上不再维护这个脚本(偶尔会修复一些严重影响使用的 bug),推荐使用更为优秀的脚本作为代替,如: 10 | - **[QuickBox-Lite](https://cn.wiki.ptbox.dev/getting-started/)** 11 | - **[swizzin](https://swizzin.ltd/)** 12 | 13 | ## Notes 14 | 15 | 1. 本脚本只支持 x86_64 (amd64) 架构,其他架构都不支持。ARM 用户建议使用 [QuickBox ARM](https://github.com/amefs/quickbox-arm) 16 | 2. 本脚本只在独服和 KVM 虚拟化的 VPS 下测试,OpenVZ、Xen 等其他虚拟化架构仍可以尝试使用,但不保证没问题 17 | 3. 本脚本目前支持 Debian 9/10, Ubuntu 16.04/18.04. *推荐使用 Debian 10 或 Ubuntu 18.04* 18 | 4. 本文的使用说明中的图片是一两年前的,与当前脚本存在较大出入(但文字内容是及时更新的) 19 | 5. 建议重装完系统后使用此脚本,非全新安装的情况下(比如你先跑了个其他盒子脚本再跑这个)不确定因素太多容易翻车 20 | 6. 目前没有简单易用的卸载方法。如果你有卸载的需求,使用前请三思 21 | 22 | ## Usage 23 | 24 | 如果你是新手,对很多选项不甚了解,直接用这个就完事了(账号密码部分替换一下): 25 | ``` 26 | bash <(wget --no-check-certificate -qO- https://github.com/Aniverse/inexistence/raw/master/inexistence.sh) \ 27 | -y --tweaks --bbr --rclone --no-system-upgrade --flexget --tr-deb --filebrowser \ 28 | --de 1.3.15 --rt 0.9.8 --qb 4.1.9 -u 这十二个字换成你的用户名 -p 这十个字换成你的密码 29 | ``` 30 | 如果你需要自定义安装选项: 31 | ``` 32 | bash <(wget --no-check-certificate -qO- https://github.com/Aniverse/inexistence/raw/master/inexistence.sh) 33 | ``` 34 | 35 | ## Installation Guide 36 | 37 | ![引导界面](https://github.com/Aniverse/pics/raw/master/inexistence/inexistence.01.png) 38 | 39 | 检查是否以 root 权限来运行脚本,检查公网 IP 地址与系统参数 40 | 41 | ![升级系统](https://github.com/Aniverse/pics/raw/master/inexistence/inexistence.02.1.png) 42 | ![升级系统](https://github.com/Aniverse/pics/raw/master/inexistence/inexistence.02.2.png) 43 | 44 | 支持 `Ubuntu 16.04 / 18.04`、`Debian 9 / 10` ,`Ubuntu 14.04` 和 `Debian 7/8` 可以用脚本升级,其他系统不支持 45 | 使用 ***`-s`*** 参数可以跳过对系统是否受支持的检查,不过这种情况下脚本能不能正常工作就是另一回事了 46 | 47 | ![系统信息](https://github.com/Aniverse/pics/raw/master/inexistence/inexistence.03.png) 48 | 49 | 显示系统信息以及注意事项 50 | 51 | ![安装时的选项](https://github.com/Aniverse/pics/raw/master/inexistence/inexistence.04.png) 52 | 53 | 1. ***是否升级系统*** 54 | 低于 `Ubuntu 18.04`、`Debian 10` 的 LTS 系统可以选择用脚本升级系统(不支持 Ubuntu 20.04) 55 | 一般来说整个升级过程应该是无交互的,应该不会碰到什么问你 Yes or No 的问题 56 | 升级完后会直接执行重启命令,重启完后你需要再次运行脚本来完成软件的安装 57 | 58 | 59 | 2. ***账号密码*** 60 | **`-u -p `** 61 | 你输入的账号密码会被用于各类软件以及 SSH 的登录验证 62 | 用户名需要以字母开头,长度 4-16 位;密码需要同时包含字母和数字,长度至少 8 位 63 | 64 | 65 | 3. ***是否更换软件源*** 66 | **目前默认直接换源不再提问,如果不想换源,请在运行脚本的使用 `--no-source-change` 参数** 67 | 这个选项决定是否替换 `/etc/apt/sources.list` 文件。 68 | 其实大多数情况下无需换源;但某些盒子默认的源可能有点问题,所以我干脆做成默认都换源了 69 | 70 | 71 | 4. ***线程数量*** 72 | **`--mt-single`**、**`--mt-double`**、**`--mt-half`**、**`--mt-max`** 73 | **目前默认直接使用全部线程不再提问,如果不想使用全部线程,请在运行脚本的使用以上的参数来指定** 74 | 编译时使用几个线程进行编译。一般来说用默认的选项,也就是全部线程都用于编译就行了 75 | 某些 VPS 可能限制下线程数量能避免编译过程中因为内存不足翻车 76 | 77 | 78 | 5. ***安装时是否创建 swap*** 79 | **`--swap`**,**`--no-swap`** 80 | **目前默认对于内存小于 1926MB 的服务器直接启用 swap 不再询问,如不想使用 swap 请用 `--swap-no` 参数** 81 | 一些内存不够大的 VPS 在编译安装时可能物理内存不足,使用 swap 可以解决这个问题 82 | 实测 1C1T 1GB 内存 的 Vultr VPS 安装 Flood 不开启 swap 的话会失败,开启就没问题了 83 | 目前对于物理内存小于 1926MB 的都默认启用 swap,如果内存大于这个值那么你根本就不会看到这个问题…… 84 | 85 | 86 | 6. ***qBittorrent*** 87 | **`--qb 4.2.3 --qb-static`**、**`--qb 3.3.11`**、**`--qb no`** 88 | static 指静态编译版本,deb 指使用 efs 菊苣编译好的 deb 包来安装。这两种安装方法的最大特点是安装速度非常快 89 | 因为 static 和 deb 安装已经很快了,因此去除了从 repo 或 ppa 安装的选项 90 | 91 | 92 | 7. ***Deluge*** 93 | **`--de 1.3.15_skip_hash_check`**、**`--de 1.3.9`**、**`--de no`** 94 | 默认选项为从源码安装 1.3.15 95 | 2.0.3 目前运行在 Python 2.7 下,且仍然有一些 PT 站不支持 2.0.3,因此不推荐使用 96 | 此外还会安装一些实用的 Deluge 第三方插件: 97 | - `AutoRemovePlus` 是自动删种插件,支持 WebUI 与 GtkUI 98 | - `ltconfig` 是一个调整 `libtorrent-rasterbar` 参数的插件,在安装完后就启用了 `High Performance Seed` 模式 99 | - `Stats`、`TotalTraffic`、`Pieces`、`LabelPlus`、`YaRSS2`、`NoFolder` 都只能在 GUI 下设置,WebUI 下无法显示 100 | - `Stats` 和 `TotalTraffic`、`Pieces` 分别可以实现速度曲线和流量统计、区块统计 101 | - `LabelPlus` 是加强版的标签管理,支持自动根据 Tracker 对种子限速,刷 Frds 可用 102 | - `YaRSS2` 是用于 RSS 的插件 103 | 隐藏选项 21,是可以跳过校验、全磁盘预分配的 1.3.15 版本 104 | **使用修改版客户端、跳过校验 存在风险,后果自负** 105 | 106 | 107 | 8. ***rTorrent*** 108 | **`--rt 0.9.8`**、**`--rt 0.9.3 --enable-ipv6`**、**`--rt no`** 109 | 这部分是调用我修改的 [rtinst](https://github.com/Aniverse/rtinst) 来安装的 110 | 注意,`Ubuntu 18.04` 和 `Debian 9/10` 因为 OpenSSL 的原因,只能使用 0.9.6 及以上的版本,更低版本无法直接安装 111 | - 安装 rTorrent,ruTorrent,nginx,ffmpeg,rar,h5ai 目录列表程序 112 | - 0.9.2-0.9.4 支持 IPv6 用的是打好补丁的版本,属于修改版客户端 113 | - 0.9.6 支持 IPv6 用的是 2018.01.30 的 feature-bind 分支,原生支持 IPv6 114 | - 设置了 Deluge、qBittorrent、Transmission、Flexget WebUI 的反代 115 | - ruTorrent 版本为来自 master 分支的 3.9 版,此外还安装了如下的第三方插件和主题 116 | - `club-QuickBox` `MaterialDesign` 第三方主题 117 | - `AutoDL-Irssi` (原版 rtinst 自带) 118 | - `Filemanager` 插件可以在 ruTorrent 上管理文件、右键创建压缩包、生成 mediainfo 和截图 119 | - `ruTorrent Mobile` 插件可以优化 ruTorrent 在手机上的显示效果(不需要的话可以手动禁用此插件) 120 | - `Fileshare` 插件创建有时限、可自定义密码的文件分享链接 121 | - `GeoIP2` 插件,代替原先的 GeoIP 插件,精确度更好,支持 IPv6 地址识别 122 | 123 | 124 | 9. **Flood** 125 | **`--flood`** 126 | **是否安装的问题已被移除,只能使用命令行参数安装** 127 | Flood 是 rTorrent 的另一个 WebUI,界面更为美观,加载速度快,不过功能上不如 ruTorrent 128 | 第一次登陆时需要填写信息,端口号是 5000,挂载点是 127.0.0.1 129 | 130 | 131 | 10. ***Transmission*** 132 | **`--tr-deb`**、**`--tr 2.83`**、**`--tr no`** 133 | Transmission 默认选择从预先编译好的 deb 安装最新版 2.94(解决了文件打开数问题) 134 | 此外还会安装 [加强版的 WebUI](https://github.com/ronggang/transmission-web-control),更方便易用 135 | ***隐藏和从 repo/ppa 安装的选项均已移除*** 136 | 137 | 138 | 11. ***FlexGet*** 139 | **`--flexget`**、**`--no-flexget`** 140 | Flexget 是一个非常强大的自动化工具,功能非常多。大多数国内盒子用户主要用它来 RSS(它能做的事情远不止 RSS) 141 | 目前脚本里安装 Flexget 时版本会指定为 3.0.31,同时如果系统自带的 Python3 版本低于 3.6 还会升级 Python3 142 | 我启用了 daemon 模式和 WebUI,还预设了一些模板,仅供参考 143 | 注意:脚本里没有启用 schedules 或 crontab,需要的话自己设置 144 | 145 | 146 | 12. ***FileBrowser Enhanced*** 147 | **`--filebrowser`**、**`--no-filebrowser`** 148 | File Browser 提供了网页文件管理器的功能, 可以用于上传、删除、预览、重命名以及编辑盒子上的文件 149 | 脚本安装的是 [荒野无灯的 Docker 版 FileBrowser Enhanced](https://hub.docker.com/r/80x86/filebrowser),[功能更加强大](https://raw.githubusercontent.com/ttys3/filebrowser-enhanced/master/FBvsFBE.zh.png) 150 | 这个增强版还可以在网页上右键获取文件的 mediainfo、制作种子、截图、解压等等,对 PT 来说也非常实用 151 | 还有一个在 http://ip:7576 网址、使用 root 运行、挂载 / 目录的 filebrowser,需要输入 `systemctl enable filebrowser-root --now` 手动启用 152 | 153 | 154 | 14. ***系统设置*** 155 | **`--tweaks`**、**`--no-tweaks`** 156 | 默认启用,具体操作如下: 157 | - 安装 [vnstat](https://github.com/vergoh/vnstat) 2.6 以及 [vnstat dashboard](https://github.com/alexandermarston/vnstat-dashboard/),可以在网页上查看流量统计 158 | - (注:vnstat dashboard 使用的前提是用脚本安装了 rTorrent,且在 Debian 8 下不可用) 159 | - 修改时区为 UTC+8 160 | - 语言编码设置为 en.UTF-8 161 | - 设置 `alias` 简化命令(私货夹带) 162 | - 修改 screenrc 设置 163 | - 将最大可用空间的硬盘分区的 Linux 保留空间调整到 1%(原先是 5%) 164 | 165 | 166 | 15. ***Remote Desktop*** 167 | **`--vnc`**、**`--x2go`** 168 | **是否安装的问题已被移除,只能使用命令行参数安装** 169 | 远程桌面可以完成一些 CLI 下做不了或者 CLI 实现起来很麻烦的操作,比如 BD-Remux,wine uTorrent 170 | 推荐使用 noVNC,网页上即可操作 171 | 172 | 173 | 16. ***wine / mono*** 174 | **`--wine`、`--mono`** 175 | **是否安装的问题已被移除,只能使用命令行参数安装** 176 | `wine` 可以实现在 Linux 上运行 Windows 程序,比如 DVDFab、uTorrent 177 | `mono` 是一个跨平台的 .NET 运行环境,BDinfoCLI、Jackett、Sonarr 等软件的运行都需要 mono 178 | 179 | 180 | 17. ***rclone*** 181 | **`--rclone`** 182 | **是否安装的问题已被移除,只能使用命令行参数安装** 183 | rclone 是一个强大的网盘同步工具。默认不安装。安装好后需要自己输入 rclone config 进行配置 184 | 此外这个选项还会安装 [gclone](https://github.com/donwa/gclone) 185 | 186 | 187 | 18. ***Some additional tools*** 188 | **`--tools`** 189 | **是否安装的问题已被移除,只能使用命令行参数安装** 190 | 安装下列软件: 191 | - `mediainfo` 用最新版是因为某些站发种填信息时有这方面的要求,比如 HDBits 192 | - `mkvtoolnix` 主要是用于做 BD-Remux 193 | - `eac3to` 需要 wine 来运行,做 remux 时用得上 194 | - `ffmpeg` 对于大多数盒子用户来说主要是拿来做视频截图用,安装的是静态编译版本 195 | 196 | 197 | 19. ***BBR*** 198 | **`--bbr`**、**`--no-bbr`** 199 | **是否安装的问题已被移除,只能使用命令行参数安装** 200 | (如果你想安装魔改版 BBR 或 锐速,请移步到 [TrCtrlProToc0l](https://github.com/Aniverse/TrCtrlProToc0l) 脚本) 201 | 会检测你当前的内核版本,大于 4.9 是默认不安装新内核与 BBR,高于 4.9 是默认直接启用BBR(不安装新内核) 202 | 注意:更换内核有风险,可能会导致无法正常启动系统 203 | 204 | 205 | 20. ***libtorrent-rasterbar*** 206 | **`--lt RC_1_1`**、**`--lt RC_1_0`**、**`--lt system`**、**`--lt 1.1.12`** 207 | **选择哪个版本的问题已被移除,默认使用 RC_1_1,只能使用命令行参数自行指定** 208 | libtorrent-rasterbar 是 Deluge 和 qBittorrent 所使用的后端,除非 qBittorrent 使用静态编译版本,不然只要选择安装 Deluge 和 qBittorrent 中的任意一样,libtorrent 都是必装的。鉴于 lt 与 de/qb 兼容的情况比较复杂,现在脚本里直接统一使用 libtorrent RC_1_1(版本号 1.1.14)。如果你需要自定义版本号,请使用 `--lt ` 参数(自定义版本时,不保证脚本能正常工作) 209 | 210 | 211 | 212 | ![确认信息](https://github.com/Aniverse/pics/raw/master/inexistence/inexistence.05.png) 213 | 214 | 如果你哪里写错了,先退出脚本重新选择;没什么问题的话就敲回车继续 215 | 使用 ***`-y`*** 可以跳过开头的信息确认和此处的信息确认,配合其他参数可以做到无交互安装 216 | 217 | ![使用参数](https://github.com/Aniverse/pics/raw/master/inexistence/inexistence.10.png) 218 | 219 | 220 | 221 | ------------------- 222 | 223 | 224 | 225 | ![安装完成界面](https://github.com/Aniverse/pics/raw/master/inexistence/inexistence.06.png) 226 | 227 | 安装完成后会输出各类 WebUI 的网址,以及本次安装花了多少时间,然后问你是否重启系统(默认是不重启) 228 | 229 | ![安装失败界面](https://github.com/Aniverse/pics/raw/master/inexistence/inexistence.07.png) 230 | 231 | 如果报道上出现了偏差,会提示你如何查看日志(报错时请务必附上日志!) 232 | 233 | ![WebUI](https://github.com/Aniverse/pics/raw/master/inexistence/inexistence.08.png) 234 | 235 | 最后打开浏览器检查下各客户端是否都能正常访问,一般是没问题的…… 236 | 237 | 238 | 239 | 240 | 241 | ## mingling 242 | 243 | **这个脚本我基本放弃治疗的,很少更新,会有过时的问题** 244 | 不做具体的介绍了,直接看图吧 245 | 246 | ![mingling.00](https://github.com/Aniverse/pics/raw/master/inexistence/mingling.00.png) 247 | ![mingling.01](https://github.com/Aniverse/pics/raw/master/inexistence/mingling.01.png) 248 | ![mingling.02](https://github.com/Aniverse/pics/raw/master/inexistence/mingling.02.png) 249 | ![mingling.03](https://github.com/Aniverse/pics/raw/master/inexistence/mingling.03.png) 250 | ![mingling.04](https://github.com/Aniverse/pics/raw/master/inexistence/mingling.04.png) 251 | ![mingling.05](https://github.com/Aniverse/pics/raw/master/inexistence/mingling.05.png) 252 | ![mingling.06](https://github.com/Aniverse/pics/raw/master/inexistence/mingling.06.png) 253 | ![mingling.07](https://github.com/Aniverse/pics/raw/master/inexistence/mingling.07.png) 254 | ![mingling.08](https://github.com/Aniverse/pics/raw/master/inexistence/mingling.08.png) 255 | 256 | 257 | 258 | 259 | 260 | ## Blu-ray 261 | 262 | 关于 bluray 脚本的详细介绍与使用,请移步到 [这里](https://github.com/Aniverse/bluray) 263 | inexistence 自带 bluray,不过不包括它的软件库(然而你可以直接用 inexistence 安装 ffmpeg、bdinfocli、mono) 264 | 更新 bluray 脚本的命令是: 265 | ```shell 266 | bash <(wget -qO- https://git.io/bluray) -u 267 | ``` 268 | 此外,如果你只用 bluray 扫描 bdinfo,可以使用以下参数运行: 269 | ```shell 270 | bluray -t no -y -s no -i auto -p "路径" 271 | ``` 272 | 你也可以写成 alias,加到 `~/.profile` 或 `~/.bashrc` 之类的文件里 273 | ```shell 274 | alias bdinfo4k="bluray -t no -y -s no -i auto -p" 275 | ``` 276 | 277 | 278 | 279 | 280 | 281 | ## BDinfo 282 | 283 | 这个是单独抽出来的,用于给 BDMV 扫描 BDinfo 的脚本 284 | 运行完以后可以直接在 SSH 上输出 BDinfo Quick Summary 285 | **注意:这个脚本不支持 UHD Blu-ray,如果需要扫 4K 蓝光,请用 bluray 脚本** 286 | 287 | ![bdinfo输出结果](https://github.com/Aniverse/pics/raw/master/aBox/bdinfo.01.png) 288 | 289 | 如果没有 mono 或 BDinfo-Cli 的话,可以先运行 `bluray` 或者 `inexistence` 脚本安装需要的软件 290 | 291 | ![bdinfo运行过程](https://github.com/Aniverse/pics/raw/master/aBox/bdinfo.02.png) 292 | 293 | 可以选择需要扫描的 mpls 294 | 295 | ![bdinfo输出结果](https://github.com/Aniverse/pics/raw/master/aBox/bdinfo.03.png) 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | ## IPv6 304 | 305 | IPv6 配置脚本,支持 Scaleway (AKA Online.net)、SeedHost (LeaseWeb) 和 Ikoula 的独服 306 | 注意:Hetzner 和 OVH 的独服,在控制面板装完系统后自带 IPv6,不需要自己配置 307 | 308 | ``` shell 309 | bash <(wget -qO- https://github.com/Aniverse/aBox/raw/master/scripts/ipv6) 310 | ``` 311 | 可以使用参数来简化操作,更详细的参数请用 `-h` 查看 312 | ``` shell 313 | bash <(wget -qO- https://github.com/Aniverse/inexistence/raw/master/00.Installation/script/ipv6.sh) -6 [address] -d [DUID] -s [subnet] 314 | ``` 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | ## xiansu 323 | 324 | **吐槽:这玩意儿有点时泪了的感觉,目前大多数机器不用限速,如果要限速你就扔了算了(传家宝除外)** 325 | **此外目前这个脚本还有一个作用:当你的 de 失联进不去的时候,用这个脚本限速到比较低的速度就容易进去** 326 | 用于给盒子限制全局上传速度的脚本,适用于保证带宽有限的盒子,比如 Online.net 的一些独服 327 | 更改限速速率时无需事先解除限速,脚本执行新的限速前会自动解除该网卡已经存在的限速 328 | 直接输入 `xiansu eth0 300` 的话会直接限速,不会有任何提示,适合用于需要开机自启的情况 329 | 330 | ``` shell 331 | xiansu 332 | xiansu [interface] [uploadspeed,Mbps] 333 | xiansu eth0 300 334 | ``` 335 | 336 | ![xiansu.01](https://github.com/Aniverse/pics/raw/master/aBox/xiansu.01.png) 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | ## jietu 346 | 347 | 用于截图和生成 mediainfo 的脚本,对于 DVD 还会加入 IFO 文件的 mediainfo,PTP 发种用得上 348 | 输入文件名则对这个文件进行操作,输入文件夹则寻找该文件夹内最大的文件当做视频文件进行操作 349 | 你可以指定分辨率进行截图,也可以不写分辨率让脚本自动计算 DAR 后的分辨率 350 | 比如有一张 DVD 的原始分辨率是 720x576,DAR 是 16:9,那么脚本就会采用 1024x576 来截图 351 | 352 | ``` shell 353 | jietu [path/to/file] [resloution] 354 | jietu "/home/aniverse/[VCB-Studio][Saenai Heroine no Sodatekata Flat][01][Ma10p_1080p][x265_flac_aac]" 1920x1080 355 | jietu [path/to/folder] 356 | jietu "/home/aniverse/deluge/download/Your Name (2016) PAL DVD9" 357 | ``` 358 | 359 | ![jietu.01](https://github.com/Aniverse/pics/raw/master/aBox/jietu.01.png) 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | ## guazai 369 | 370 | 用于把 ISO 挂载成文件夹的脚本,使用的是 mount 命令,因此一般来说需要 root 权限才能运行 371 | 372 | ![guazai.03](https://github.com/Aniverse/pics/raw/master/aBox/guazai.03.png) 373 | 374 | `guazai` 后输入文件名则挂载那个文件 375 | 376 | ![guazai.01](https://github.com/Aniverse/pics/raw/master/aBox/guazai.01.png) 377 | ![guazai.02](https://github.com/Aniverse/pics/raw/master/aBox/guazai.02.png) 378 | 379 | `guazai` 后输入路径则会寻找该路径下的所有 ISO 进行挂载 380 | 直接输入 `guazai`,会在当前目录下寻找 ISO 挂载 381 | 382 | 383 | 384 | 385 | 386 | 387 | 388 | ## jiegua 389 | 390 | 解除挂载用的脚本,会把能检测到的所有已挂载的 ISO 全部解除挂载 391 | 392 | ![jiegua.01](https://github.com/Aniverse/pics/raw/master/aBox/jiegua.01.png) 393 | 394 | `guazai` + `jietu` + `jiegua` 三连 395 | 396 | 397 | 398 | 399 | 400 | 401 | ## Something else 402 | 403 | 还有一些脚本,比如 `zuozhong`,在此不作介绍了,基本看名字都知道是干什么用的了 404 | 405 | 1. 有 bug 的话欢迎反馈,**但不保证能解决**,且有些问题可能不是本脚本造成的 406 | 2. 有意见或者改进也欢迎告知 407 | 3. [有问题也可以来这个基本没人的本脚本交流群反馈,有事别问群主……](https://gist.github.com/Aniverse/cc885b91fb7c5d5139c3ffce7e28b0da) 408 | 409 | ## Issues 410 | 411 | 如需提交 bug ,请确保带有如下信息: 412 | 1. 具体的日志,日志的查看方法在最后安装出错后会有提示(可以用 `s-end` 再次查看) 413 | 2. SSH 输入 `s-opt` 后输出的全部信息 414 | 415 | ## Some references 416 | 417 | Special thanks to [efs](https://github.com/amefs) and [DieNacht](https://github.com/DieNacht). 418 | Latest qBittorrent static builds are downloaded from [userdocs/qbittorrent-nox-static](https://github.com/userdocs/qbittorrent-nox-static/releases). 419 | 420 | https://github.com/arakasi72/rtinst 421 | https://github.com/QuickBox/QB 422 | https://github.com/liaralabs/swizzin 423 | https://www.dwhd.org 424 | https://moeclub.org 425 | https://sometimesnaive.org 426 | https://www.94ish.me 427 | https://blog.gloriousdays.pw 428 | https://blog.rhilip.info 429 | https://ymgblog.com 430 | http://wilywx.com 431 | http://xiaofd.win/onekey-ruisu.html 432 | https://github.com/teddysun/across 433 | https://github.com/FunctionClub 434 | https://github.com/oooldking/script 435 | https://github.com/gutenye/systemd-units 436 | https://github.com/outime/ipv6-dhclient-script 437 | https://github.com/GalaxyXL/qBittorrent-autoremove 438 | https://hdbits.org/forums/viewtopic?topicid=61434 439 | https://tieba.baidu.com/p/5536354634 440 | https://serverfault.com/questions/48724/100-non-interactive-debian-dist-upgrade 441 | https://stackoverflow.com/questions/36524872/check-single-character-in-array-bash-for-password-generator 442 | https://github.com/Azure/azure-devops-utils 443 | https://github.com/linuxserver/reverse-proxy-confs 444 | https://github.com/zoffline/BDInfoCLI-ng 445 | https://github.com/IvonWei/flexget_qbittorrent_mod 446 | https://github.com/Juszoe/flexget-nexusphp 447 | https://github.com/CzBiX/qb-web 448 | https://github.com/miniers/qb-web 449 | https://github.com/KozakaiAya/libqbpasswd 450 | --------------------------------------------------------------------------------