├── AppNodeUpdateCerts.php ├── AutoDD.sh ├── AutoReinstall.sh ├── InstallNET.sh ├── LICENSE ├── LVM_Auto_Partition.sh ├── clearlog.sh ├── config └── qbittorrent │ ├── 4.2.5.conf │ ├── 4.3.9.conf │ └── systemd.service ├── docker.sh ├── docker_install.sh ├── filebrowser.sh ├── qbittorrent.sh └── wget_udeb_amd64.tar.gz /AppNodeUpdateCerts.php: -------------------------------------------------------------------------------- 1 | 'sqlite', 19 | 'database' => $dbpath 20 | ]); 21 | 22 | $size = count($sitecode); 23 | for ($i=0;$i<$size;$i++) 24 | { 25 | $data = $db -> get("site",[ 26 | "setting" 27 | ],[ 28 | "site_code" => $sitecode[$i] 29 | ]); 30 | 31 | $data = json_decode($data["setting"]); 32 | 33 | $newkey = file_get_contents("$certpath/$certname[$i]/$certname[$i].key"); 34 | $newcert = file_get_contents("$certpath/$certname[$i]/fullchain.cer"); 35 | 36 | $data -> SSLKeyPemCode = $newkey; 37 | $data -> SSLCertPemCode = $newcert; 38 | 39 | $data = json_encode($data); 40 | 41 | $data = $db -> update("site",[ 42 | "setting" => $data 43 | ],[ 44 | "site_code" => $sitecode[$i] 45 | ]); 46 | 47 | if ($enable_nginx_cert_replace && $ngxcertdir[$i] != '') { 48 | file_put_contents("$ngxcertdir[$i]/site.key", $newkey); 49 | file_put_contents("$ngxcertdir[$i]/site.crt", $newcert); 50 | } 51 | } 52 | 53 | echo 'Done!'; -------------------------------------------------------------------------------- /AutoDD.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | clear 4 | echo "This script is deprecated, use https://git.io/AutoReinstall.sh instead." 5 | -------------------------------------------------------------------------------- /AutoReinstall.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [[ $EUID -ne 0 ]]; then 4 | clear 5 | echo "Error: This script must be run as root!" 1>&2 6 | exit 1 7 | fi 8 | 9 | if [ -f "/usr/bin/yum" ] && [ -d "/etc/yum.repos.d" ]; then 10 | yum install -y wget curl 11 | elif [ -f "/usr/bin/apt-get" ] && [ -f "/usr/bin/dpkg" ]; then 12 | apt-get install -y wget curl 13 | fi 14 | 15 | function CopyRight() { 16 | clear 17 | echo "########################################################" 18 | echo "# #" 19 | echo "# Auto Reinstall Script #" 20 | echo "# #" 21 | echo "# Author: hiCasper #" 22 | echo "# Blog: https://blog.hicasper.com/post/135.html #" 23 | echo "# Feedback: https://github.com/hiCasper/Shell/issues #" 24 | echo "# Last Modified: 2022-08-07 #" 25 | echo "# #" 26 | echo "# Supported by MoeClub #" 27 | echo "# #" 28 | echo "########################################################" 29 | echo -e "\n" 30 | } 31 | 32 | function isValidIp() { 33 | local ip=$1 34 | local ret=1 35 | if [[ $ip =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then 36 | ip=(${ip//\./ }) 37 | [[ ${ip[0]} -le 255 && ${ip[1]} -le 255 && ${ip[2]} -le 255 && ${ip[3]} -le 255 ]] 38 | ret=$? 39 | fi 40 | return $ret 41 | } 42 | 43 | function ipCheck() { 44 | isLegal=0 45 | for add in $MAINIP $GATEWAYIP $NETMASK; do 46 | isValidIp $add 47 | if [ $? -eq 1 ]; then 48 | isLegal=1 49 | fi 50 | done 51 | return $isLegal 52 | } 53 | 54 | function GetIp() { 55 | MAINIP=$(ip route get 1 | awk -F 'src ' '{print $2}' | awk '{print $1}') 56 | GATEWAYIP=$(ip route | grep default | awk '{print $3}' | head -1) 57 | SUBNET=$(ip -o -f inet addr show | awk '/scope global/{sub(/[^.]+\//,"0/",$4);print $4}' | head -1 | awk -F '/' '{print $2}') 58 | value=$(( 0xffffffff ^ ((1 << (32 - $SUBNET)) - 1) )) 59 | NETMASK="$(( (value >> 24) & 0xff )).$(( (value >> 16) & 0xff )).$(( (value >> 8) & 0xff )).$(( value & 0xff ))" 60 | } 61 | 62 | function UpdateIp() { 63 | read -r -p "Your IP: " MAINIP 64 | read -r -p "Your Gateway: " GATEWAYIP 65 | read -r -p "Your Netmask: " NETMASK 66 | } 67 | 68 | function SetNetwork() { 69 | isAuto='0' 70 | if [[ -f '/etc/network/interfaces' ]];then 71 | [[ ! -z "$(sed -n '/iface.*inet static/p' /etc/network/interfaces)" ]] && isAuto='1' 72 | [[ -d /etc/network/interfaces.d ]] && { 73 | cfgNum="$(find /etc/network/interfaces.d -name '*.cfg' |wc -l)" || cfgNum='0' 74 | [[ "$cfgNum" -ne '0' ]] && { 75 | for netConfig in `ls -1 /etc/network/interfaces.d/*.cfg` 76 | do 77 | [[ ! -z "$(cat $netConfig | sed -n '/iface.*inet static/p')" ]] && isAuto='1' 78 | done 79 | } 80 | } 81 | fi 82 | 83 | if [[ -d '/etc/sysconfig/network-scripts' ]];then 84 | cfgNum="$(find /etc/network/interfaces.d -name '*.cfg' |wc -l)" || cfgNum='0' 85 | [[ "$cfgNum" -ne '0' ]] && { 86 | for netConfig in `ls -1 /etc/sysconfig/network-scripts/ifcfg-* | grep -v 'lo$' | grep -v ':[0-9]\{1,\}'` 87 | do 88 | [[ ! -z "$(cat $netConfig | sed -n '/BOOTPROTO.*[sS][tT][aA][tT][iI][cC]/p')" ]] && isAuto='1' 89 | done 90 | } 91 | fi 92 | } 93 | 94 | function NetMode() { 95 | CopyRight 96 | 97 | if [ "$isAuto" == '0' ]; then 98 | read -r -p "Use DHCP to configure network automatically? [Y/n]:" input 99 | case $input in 100 | [yY][eE][sS]|[yY]) NETSTR='' ;; 101 | [nN][oO]|[nN]) isAuto='1' ;; 102 | *) NETSTR='' ;; 103 | esac 104 | fi 105 | 106 | if [ "$isAuto" == '1' ]; then 107 | GetIp 108 | ipCheck 109 | if [ $? -ne 0 ]; then 110 | echo -e "Error occurred when detecting ip. Please input manually.\n" 111 | UpdateIp 112 | else 113 | CopyRight 114 | echo "IP: $MAINIP" 115 | echo "Gateway: $GATEWAYIP" 116 | echo "Netmask: $NETMASK" 117 | echo -e "\n" 118 | read -r -p "Confirm? [Y/n]:" input 119 | case $input in 120 | [yY][eE][sS]|[yY]) ;; 121 | [nN][oO]|[nN]) 122 | echo -e "\n" 123 | UpdateIp 124 | ipCheck 125 | [[ $? -ne 0 ]] && { 126 | clear 127 | echo -e "Input error!\n" 128 | exit 1 129 | } 130 | ;; 131 | *) ;; 132 | esac 133 | fi 134 | NETSTR="--ip-addr ${MAINIP} --ip-gate ${GATEWAYIP} --ip-mask ${NETMASK}" 135 | fi 136 | } 137 | 138 | function RHELImageBootConf() { 139 | touch /tmp/bootconf.sh 140 | echo '#!/bin/sh'>/tmp/bootconf.sh 141 | 142 | staticIp='1' 143 | if [ "$isAuto" == '1' ]; then 144 | echo -e "\n" 145 | read -r -p "Writing static ip to system? [Y/n]: " input 146 | case $input in 147 | [yY][eE][sS]|[yY]) staticIp='0' ;; 148 | *) staticIp='1' ;; 149 | esac 150 | fi 151 | 152 | if [ "$isAuto" == '1' ] && [ "$staticIp" == '0' ]; then 153 | cat >>/tmp/bootconf.sh <> /etc/sysconfig/network-scripts/ifcfg-eth0 156 | EOF 157 | fi 158 | cat >>/tmp/bootconf.sh <> \/mnt\/etc\/rc.d\/rc.local; sync; umount \/mnt; \\' /tmp/InstallNET.sh 165 | sed -i '/newc/i\cp -f \/tmp\/bootconf.sh \/tmp\/boot\/bootconf.sh' /tmp/InstallNET.sh 166 | } 167 | 168 | function Start() { 169 | CopyRight 170 | 171 | isCN='0' 172 | geo=$(curl -fsSL -m 10 http://ipinfo.io/json | grep "\"country\": \"CN\"") 173 | if [[ "$geo" != "" ]];then 174 | isCN='1' 175 | fi 176 | 177 | if [ "$isAuto" == '0' ]; then 178 | echo "Network Type: DHCP" 179 | else 180 | echo "IP: $MAINIP" 181 | echo "Gateway: $GATEWAYIP" 182 | echo "Netmask: $NETMASK" 183 | fi 184 | 185 | [[ "$isCN" == '1' ]] && echo "Location: Domestic" 186 | 187 | if [ -f "/tmp/InstallNET.sh" ]; then 188 | rm -f /tmp/InstallNET.sh 189 | fi 190 | curl -sSL -o /tmp/InstallNET.sh 'https://fastly.jsdelivr.net/gh/hiCasper/Shell@latest/InstallNET.sh' && chmod a+x /tmp/InstallNET.sh 191 | #curl -sSL -o /tmp/InstallNET.sh 'https://cdn.jsdelivr.net/gh/MoeClub/Note@latest/InstallNET.sh' && chmod a+x /tmp/InstallNET.sh 192 | 193 | CMIRROR='' 194 | CVMIRROR='' 195 | DMIRROR='' 196 | UMIRROR='' 197 | if [[ "$isCN" == '1' ]];then 198 | CMIRROR="--mirror http://mirrors.cloud.tencent.com/centos" 199 | CVMIRROR="--mirror http://mirrors.cloud.tencent.com/centos-vault" 200 | DMIRROR="--mirror http://mirrors.cloud.tencent.com/debian" 201 | UMIRROR="--mirror http://mirrors.cloud.tencent.com/ubuntu" 202 | fi 203 | 204 | sed -i 's/$1$4BJZaD0A$y1QykUnJ6mXprENfwpseH0/$1$7R4IuxQb$J8gcq7u9K0fNSsDNFEfr90/' /tmp/InstallNET.sh 205 | 206 | echo -e "\nPlease select an OS:" 207 | echo " 1) CentOS 7.8 (DD Image)" 208 | echo " 2) CentOS 7.6 (DD Image, ServerSpeeder Avaliable)" 209 | echo -e " 3) Rocky Linux 8.6 (\033[31mExperimental, NOT SUPPORT LSI/BusLogic disk controller\033[0m)" 210 | echo " 4) Debian 10" 211 | echo " 5) Debian 11" 212 | echo " 6) Ubuntu 16.04" 213 | echo " 7) Ubuntu 18.04" 214 | echo " 8) Ubuntu 20.04" 215 | echo " 9) Custom image" 216 | echo -e "\033[31m Deprecated:\033[0m" 217 | echo " 10) CentOS 6" 218 | echo " 11) Debian 9" 219 | echo " 12) Ubuntu 14.04" 220 | echo " 0) Exit" 221 | echo -ne "\nYour option: " 222 | read N 223 | case $N in 224 | 1) echo -e "\nPassword: Pwd@CentOS\n"; RHELImageBootConf; read -s -n1 -p "Press any key to continue..." ; bash /tmp/InstallNET.sh $NETSTR -dd 'https://api.moetools.net/get/centos-78-image' $DMIRROR ;; 225 | 2) echo -e "\nPassword: Pwd@CentOS\n"; RHELImageBootConf; read -s -n1 -p "Press any key to continue..." ; bash /tmp/InstallNET.sh $NETSTR -dd 'https://api.moetools.net/get/centos-76-image' $DMIRROR ;; 226 | 3) echo -e "\nPassword: Pwd@Linux\n"; RHELImageBootConf; read -s -n1 -p "Press any key to continue..." ; bash /tmp/InstallNET.sh $NETSTR -dd 'https://api.moetools.net/get/rocky-8-image' $DMIRROR ;; 227 | 4) echo -e "\nPassword: Pwd@Linux\n"; read -s -n1 -p "Press any key to continue..." ; bash /tmp/InstallNET.sh -d 10 -v 64 -a $NETSTR $DMIRROR ;; 228 | 5) echo -e "\nPassword: Pwd@Linux\n"; read -s -n1 -p "Press any key to continue..." ; bash /tmp/InstallNET.sh -d 11 -v 64 -a $NETSTR $DMIRROR ;; 229 | 6) echo -e "\nPassword: Pwd@Linux\n"; read -s -n1 -p "Press any key to continue..." ; bash /tmp/InstallNET.sh -u 16.04 -v 64 -a $NETSTR $UMIRROR ;; 230 | 7) echo -e "\nPassword: Pwd@Linux\n"; read -s -n1 -p "Press any key to continue..." ; bash /tmp/InstallNET.sh -u 18.04 -v 64 -a $NETSTR $UMIRROR ;; 231 | 8) echo -e "\nPassword: Pwd@Linux\n"; read -s -n1 -p "Press any key to continue..." ; bash /tmp/InstallNET.sh -u 20.04 -v 64 -a $NETSTR $UMIRROR ;; 232 | 9) 233 | echo -e "\n" 234 | read -r -p "Custom image URL: " imgURL 235 | echo -e "\n" 236 | read -r -p "Are you sure start reinstall? [y/N]: " input 237 | case $input in 238 | [yY][eE][sS]|[yY]) bash /tmp/InstallNET.sh $NETSTR -dd $imgURL $DMIRROR ;; 239 | *) clear; echo "Canceled by user!"; exit 1;; 240 | esac 241 | ;; 242 | 10) echo -e "\nPassword: Pwd@Linux\n"; read -s -n1 -p "Press any key to continue..." ; bash /tmp/InstallNET.sh -c 6.10 -v 64 -a $NETSTR $CMIRROR ;; 243 | 11) echo -e "\nPassword: Pwd@Linux\n"; read -s -n1 -p "Press any key to continue..." ; bash /tmp/InstallNET.sh -d 9 -v 64 -a $NETSTR $DMIRROR ;; 244 | 12) echo -e "\nPassword: Pwd@Linux\n"; read -s -n1 -p "Press any key to continue..." ; bash /tmp/InstallNET.sh -u 14.04 -v 64 -a $NETSTR $UMIRROR ;; 245 | 0) exit 0;; 246 | *) echo "Wrong input!"; exit 1;; 247 | esac 248 | } 249 | 250 | SetNetwork 251 | NetMode 252 | Start 253 | -------------------------------------------------------------------------------- /InstallNET.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ## License: GPL 4 | ## It can reinstall Debian, Ubuntu, CentOS system with network. 5 | ## Default root password: MoeClub.org 6 | ## Blog: https://moeclub.org 7 | ## Written By MoeClub.org 8 | 9 | export tmpVER='' 10 | export tmpDIST='' 11 | export tmpURL='' 12 | export tmpWORD='' 13 | export tmpMirror='' 14 | export ipAddr='' 15 | export ipMask='' 16 | export ipGate='' 17 | export ipDNS='8.8.8.8' 18 | export IncDisk='default' 19 | export interface='' 20 | export interfaceSelect='' 21 | export Relese='' 22 | export sshPORT='22' 23 | export ddMode='0' 24 | export setNet='0' 25 | export setRDP='0' 26 | export setIPv6='0' 27 | export isMirror='0' 28 | export FindDists='0' 29 | export loaderMode='0' 30 | export IncFirmware='0' 31 | export SpikCheckDIST='0' 32 | export setInterfaceName='0' 33 | export UNKNOWHW='0' 34 | export UNVER='6.4' 35 | export GRUBDIR='' 36 | export GRUBFILE='' 37 | export GRUBVER='' 38 | export VER='' 39 | export setCMD='' 40 | export setConsole='' 41 | 42 | while [[ $# -ge 1 ]]; do 43 | case $1 in 44 | -v|--ver) 45 | shift 46 | tmpVER="$1" 47 | shift 48 | ;; 49 | -d|--debian) 50 | shift 51 | Relese='Debian' 52 | tmpDIST="$1" 53 | shift 54 | ;; 55 | -u|--ubuntu) 56 | shift 57 | Relese='Ubuntu' 58 | tmpDIST="$1" 59 | shift 60 | ;; 61 | -c|--centos) 62 | shift 63 | Relese='CentOS' 64 | tmpDIST="$1" 65 | shift 66 | ;; 67 | -dd|--image) 68 | shift 69 | ddMode='1' 70 | tmpURL="$1" 71 | shift 72 | ;; 73 | -p|--password) 74 | shift 75 | tmpWORD="$1" 76 | shift 77 | ;; 78 | -i|--interface) 79 | shift 80 | interfaceSelect="$1" 81 | shift 82 | ;; 83 | --ip-addr) 84 | shift 85 | ipAddr="$1" 86 | shift 87 | ;; 88 | --ip-mask) 89 | shift 90 | ipMask="$1" 91 | shift 92 | ;; 93 | --ip-gate) 94 | shift 95 | ipGate="$1" 96 | shift 97 | ;; 98 | --ip-dns) 99 | shift 100 | ipDNS="$1" 101 | shift 102 | ;; 103 | --dev-net) 104 | shift 105 | setInterfaceName='1' 106 | ;; 107 | --loader) 108 | shift 109 | loaderMode='1' 110 | ;; 111 | -apt|-yum|--mirror) 112 | shift 113 | isMirror='1' 114 | tmpMirror="$1" 115 | shift 116 | ;; 117 | -rdp) 118 | shift 119 | setRDP='1' 120 | WinRemote="$1" 121 | shift 122 | ;; 123 | -cmd) 124 | shift 125 | setCMD="$1" 126 | shift 127 | ;; 128 | -console) 129 | shift 130 | setConsole="$1" 131 | shift 132 | ;; 133 | -firmware) 134 | shift 135 | IncFirmware="1" 136 | ;; 137 | -port) 138 | shift 139 | sshPORT="$1" 140 | shift 141 | ;; 142 | --noipv6) 143 | shift 144 | setIPv6='1' 145 | ;; 146 | -a|--auto|-m|--manual|-ssl) 147 | shift 148 | ;; 149 | *) 150 | if [[ "$1" != 'error' ]]; then echo -ne "\nInvaild option: '$1'\n\n"; fi 151 | echo -ne " Usage:\n\tbash $(basename $0)\t-d/--debian [\033[33m\033[04mdists-name\033[0m]\n\t\t\t\t-u/--ubuntu [\033[04mdists-name\033[0m]\n\t\t\t\t-c/--centos [\033[04mdists-name\033[0m]\n\t\t\t\t-v/--ver [32/i386|64/\033[33m\033[04mamd64\033[0m] [\033[33m\033[04mdists-verison\033[0m]\n\t\t\t\t--ip-addr/--ip-gate/--ip-mask\n\t\t\t\t-apt/-yum/--mirror\n\t\t\t\t-dd/--image\n\t\t\t\t-p [linux password]\n\t\t\t\t-port [linux ssh port]\n" 152 | exit 1; 153 | ;; 154 | esac 155 | done 156 | 157 | [[ "$EUID" -ne '0' ]] && echo "Error:This script must be run as root!" && exit 1; 158 | 159 | function dependence(){ 160 | Full='0'; 161 | for BIN_DEP in `echo "$1" |sed 's/,/\n/g'` 162 | do 163 | if [[ -n "$BIN_DEP" ]]; then 164 | Found='0'; 165 | for BIN_PATH in `echo "$PATH" |sed 's/:/\n/g'` 166 | do 167 | ls $BIN_PATH/$BIN_DEP >/dev/null 2>&1; 168 | if [ $? == '0' ]; then 169 | Found='1'; 170 | break; 171 | fi 172 | done 173 | if [ "$Found" == '1' ]; then 174 | echo -en "[\033[32mok\033[0m]\t"; 175 | else 176 | Full='1'; 177 | echo -en "[\033[31mNot Install\033[0m]"; 178 | fi 179 | echo -en "\t$BIN_DEP\n"; 180 | fi 181 | done 182 | if [ "$Full" == '1' ]; then 183 | echo -ne "\n\033[31mError! \033[0mPlease use '\033[33mapt-get\033[0m' or '\033[33myum\033[0m' install it.\n\n\n" 184 | exit 1; 185 | fi 186 | } 187 | 188 | function selectMirror(){ 189 | [ $# -ge 3 ] || exit 1 190 | Relese=$(echo "$1" |sed -r 's/(.*)/\L\1/') 191 | DIST=$(echo "$2" |sed 's/\ //g' |sed -r 's/(.*)/\L\1/') 192 | VER=$(echo "$3" |sed 's/\ //g' |sed -r 's/(.*)/\L\1/') 193 | New=$(echo "$4" |sed 's/\ //g') 194 | [ -n "$Relese" ] && [ -n "$DIST" ] && [ -n "$VER" ] || exit 1 195 | if [ "$Relese" == "debian" ] || [ "$Relese" == "ubuntu" ]; then 196 | [ "$DIST" == "focal" ] && legacy="legacy-" || legacy="" 197 | TEMP="SUB_MIRROR/dists/${DIST}/main/installer-${VER}/current/${legacy}images/netboot/${Relese}-installer/${VER}/initrd.gz" 198 | elif [ "$Relese" == "centos" ]; then 199 | TEMP="SUB_MIRROR/${DIST}/os/${VER}/isolinux/initrd.img" 200 | fi 201 | [ -n "$TEMP" ] || exit 1 202 | mirrorStatus=0 203 | declare -A MirrorBackup 204 | MirrorBackup=(["debian0"]="" ["debian1"]="http://deb.debian.org/debian" ["debian2"]="http://archive.debian.org/debian" ["ubuntu0"]="" ["ubuntu1"]="http://archive.ubuntu.com/ubuntu" ["ubuntu2"]="http://ports.ubuntu.com" ["centos0"]="" ["centos1"]="http://mirror.centos.org/centos" ["centos2"]="http://vault.centos.org") 205 | echo "$New" |grep -q '^http://\|^https://\|^ftp://' && MirrorBackup[${Relese}0]="$New" 206 | for mirror in $(echo "${!MirrorBackup[@]}" |sed 's/\ /\n/g' |sort -n |grep "^$Relese") 207 | do 208 | Current="${MirrorBackup[$mirror]}" 209 | [ -n "$Current" ] || continue 210 | MirrorURL=`echo "$TEMP" |sed "s#SUB_MIRROR#${Current}#g"` 211 | wget --no-check-certificate --spider --timeout=3 -o /dev/null "$MirrorURL" 212 | [ $? -eq 0 ] && mirrorStatus=1 && break 213 | done 214 | [ $mirrorStatus -eq 1 ] && echo "$Current" || exit 1 215 | } 216 | 217 | function netmask() { 218 | n="${1:-32}" 219 | b="" 220 | m="" 221 | for((i=0;i<32;i++)){ 222 | [ $i -lt $n ] && b="${b}1" || b="${b}0" 223 | } 224 | for((i=0;i<4;i++)){ 225 | s=`echo "$b"|cut -c$[$[$i*8]+1]-$[$[$i+1]*8]` 226 | [ "$m" == "" ] && m="$((2#${s}))" || m="${m}.$((2#${s}))" 227 | } 228 | echo "$m" 229 | } 230 | 231 | function getInterface(){ 232 | interface="" 233 | Interfaces=`cat /proc/net/dev |grep ':' |cut -d':' -f1 |sed 's/\s//g' |grep -iv '^lo\|^sit\|^stf\|^gif\|^dummy\|^vmnet\|^vir\|^gre\|^ipip\|^ppp\|^bond\|^tun\|^tap\|^ip6gre\|^ip6tnl\|^teql\|^ocserv\|^vpn'` 234 | defaultRoute=`ip route show default |grep "^default"` 235 | for item in `echo "$Interfaces"` 236 | do 237 | [ -n "$item" ] || continue 238 | echo "$defaultRoute" |grep -q "$item" 239 | [ $? -eq 0 ] && interface="$item" && break 240 | done 241 | echo "$interface" 242 | } 243 | 244 | function getDisk(){ 245 | disks=`lsblk | sed 's/[[:space:]]*$//g' |grep "disk$" |cut -d' ' -f1 |grep -v "fd[0-9]*\|sr[0-9]*" |head -n1` 246 | [ -n "$disks" ] || echo "" 247 | echo "$disks" |grep -q "/dev" 248 | [ $? -eq 0 ] && echo "$disks" || echo "/dev/$disks" 249 | } 250 | 251 | function diskType(){ 252 | echo `udevadm info --query all "$1" 2>/dev/null |grep 'ID_PART_TABLE_TYPE' |cut -d'=' -f2` 253 | } 254 | 255 | function getGrub(){ 256 | Boot="${1:-/boot}" 257 | folder=`find "$Boot" -type d -name "grub*" 2>/dev/null |head -n1` 258 | [ -n "$folder" ] || return 259 | fileName=`ls -1 "$folder" 2>/dev/null |grep '^grub.conf$\|^grub.cfg$'` 260 | if [ -z "$fileName" ]; then 261 | ls -1 "$folder" 2>/dev/null |grep -q '^grubenv$' 262 | [ $? -eq 0 ] || return 263 | folder=`find "$Boot" -type f -name "grubenv" 2>/dev/null |xargs dirname |grep -v "^$folder" |head -n1` 264 | [ -n "$folder" ] || return 265 | fileName=`ls -1 "$folder" 2>/dev/null |grep '^grub.conf$\|^grub.cfg$'` 266 | fi 267 | [ -n "$fileName" ] || return 268 | [ "$fileName" == "grub.cfg" ] && ver="0" || ver="1" 269 | echo "${folder}:${fileName}:${ver}" 270 | } 271 | 272 | function lowMem(){ 273 | mem=`grep "^MemTotal:" /proc/meminfo 2>/dev/null |grep -o "[0-9]*"` 274 | [ -n "$mem" ] || return 0 275 | [ "$mem" -le "524288" ] && return 1 || return 0 276 | } 277 | 278 | if [[ "$loaderMode" == "0" ]]; then 279 | Grub=`getGrub "/boot"` 280 | [ -z "$Grub" ] && echo -ne "Error! Not Found grub.\n" && exit 1; 281 | GRUBDIR=`echo "$Grub" |cut -d':' -f1` 282 | GRUBFILE=`echo "$Grub" |cut -d':' -f2` 283 | GRUBVER=`echo "$Grub" |cut -d':' -f3` 284 | fi 285 | 286 | [ -n "$Relese" ] || Relese='Debian' 287 | linux_relese=$(echo "$Relese" |sed 's/\ //g' |sed -r 's/(.*)/\L\1/') 288 | clear && echo -e "\n\033[36m# Check Dependence\033[0m\n" 289 | 290 | if [[ "$ddMode" == '1' ]]; then 291 | dependence iconv; 292 | linux_relese='debian'; 293 | tmpDIST='bullseye'; 294 | tmpVER='amd64'; 295 | fi 296 | 297 | [ -n "$ipAddr" ] && [ -n "$ipMask" ] && [ -n "$ipGate" ] && setNet='1'; 298 | if [ "$setNet" == "0" ]; then 299 | dependence ip 300 | [ -n "$interface" ] || interface=`getInterface` 301 | iAddr=`ip addr show dev $interface |grep "inet.*" |head -n1 |grep -o '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\/[0-9]\{1,2\}'` 302 | ipAddr=`echo ${iAddr} |cut -d'/' -f1` 303 | ipMask=`netmask $(echo ${iAddr} |cut -d'/' -f2)` 304 | ipGate=`ip route show default |grep "^default" |grep -o '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}' |head -n1` 305 | fi 306 | if [ -z "$interface" ]; then 307 | dependence ip 308 | [ -n "$interface" ] || interface=`getInterface` 309 | fi 310 | IPv4="$ipAddr"; MASK="$ipMask"; GATE="$ipGate"; 311 | 312 | [ -n "$IPv4" ] && [ -n "$MASK" ] && [ -n "$GATE" ] && [ -n "$ipDNS" ] || { 313 | echo -ne '\nError: Invalid network config\n\n' 314 | bash $0 error; 315 | exit 1; 316 | } 317 | 318 | if [[ "$Relese" == 'Debian' ]] || [[ "$Relese" == 'Ubuntu' ]]; then 319 | dependence wget,awk,grep,sed,cut,cat,lsblk,cpio,gzip,find,dirname,basename; 320 | elif [[ "$Relese" == 'CentOS' ]]; then 321 | dependence wget,awk,grep,sed,cut,cat,lsblk,cpio,gzip,find,dirname,basename,file,xz; 322 | fi 323 | [ -n "$tmpWORD" ] && dependence openssl 324 | [[ -n "$tmpWORD" ]] && myPASSWORD="$(openssl passwd -1 "$tmpWORD")"; 325 | [[ -z "$myPASSWORD" ]] && myPASSWORD='$1$4BJZaD0A$y1QykUnJ6mXprENfwpseH0'; 326 | 327 | tempDisk=`getDisk`; [ -n "$tempDisk" ] && IncDisk="$tempDisk" 328 | 329 | case `uname -m` in aarch64|arm64) VER="arm64";; x86|i386|i686) VER="i386";; x86_64|amd64) VER="amd64";; *) VER="";; esac 330 | tmpVER="$(echo "$tmpVER" |sed -r 's/(.*)/\L\1/')"; 331 | if [[ "$VER" != "arm64" ]] && [[ -n "$tmpVER" ]]; then 332 | case "$tmpVER" in i386|i686|x86|32) VER="i386";; amd64|x86_64|x64|64) [[ "$Relese" == 'CentOS' ]] && VER='x86_64' || VER='amd64';; *) VER='';; esac 333 | fi 334 | 335 | if [[ ! -n "$VER" ]]; then 336 | echo "Error! Not Architecture." 337 | bash $0 error; 338 | exit 1; 339 | fi 340 | 341 | if [[ -z "$tmpDIST" ]]; then 342 | [ "$Relese" == 'Debian' ] && tmpDIST='buster'; 343 | [ "$Relese" == 'Ubuntu' ] && tmpDIST='bionic'; 344 | [ "$Relese" == 'CentOS' ] && tmpDIST='6.10'; 345 | fi 346 | 347 | if [[ -n "$tmpDIST" ]]; then 348 | if [[ "$Relese" == 'Debian' ]]; then 349 | SpikCheckDIST='0' 350 | DIST="$(echo "$tmpDIST" |sed -r 's/(.*)/\L\1/')"; 351 | echo "$DIST" |grep -q '[0-9]'; 352 | [[ $? -eq '0' ]] && { 353 | isDigital="$(echo "$DIST" |grep -o '[\.0-9]\{1,\}' |sed -n '1h;1!H;$g;s/\n//g;$p' |cut -d'.' -f1)"; 354 | [[ -n $isDigital ]] && { 355 | [[ "$isDigital" == '7' ]] && DIST='wheezy'; 356 | [[ "$isDigital" == '8' ]] && DIST='jessie'; 357 | [[ "$isDigital" == '9' ]] && DIST='stretch'; 358 | [[ "$isDigital" == '10' ]] && DIST='buster'; 359 | [[ "$isDigital" == '11' ]] && DIST='bullseye'; 360 | } 361 | } 362 | LinuxMirror=$(selectMirror "$Relese" "$DIST" "$VER" "$tmpMirror") 363 | fi 364 | if [[ "$Relese" == 'Ubuntu' ]]; then 365 | SpikCheckDIST='0' 366 | DIST="$(echo "$tmpDIST" |sed -r 's/(.*)/\L\1/')"; 367 | echo "$DIST" |grep -q '[0-9]'; 368 | [[ $? -eq '0' ]] && { 369 | isDigital="$(echo "$DIST" |grep -o '[\.0-9]\{1,\}' |sed -n '1h;1!H;$g;s/\n//g;$p')"; 370 | [[ -n $isDigital ]] && { 371 | [[ "$isDigital" == '12.04' ]] && DIST='precise'; 372 | [[ "$isDigital" == '14.04' ]] && DIST='trusty'; 373 | [[ "$isDigital" == '16.04' ]] && DIST='xenial'; 374 | [[ "$isDigital" == '18.04' ]] && DIST='bionic'; 375 | [[ "$isDigital" == '20.04' ]] && DIST='focal'; 376 | } 377 | } 378 | LinuxMirror=$(selectMirror "$Relese" "$DIST" "$VER" "$tmpMirror") 379 | fi 380 | if [[ "$Relese" == 'CentOS' ]]; then 381 | SpikCheckDIST='1' 382 | DISTCheck="$(echo "$tmpDIST" |grep -o '[\.0-9]\{1,\}' |head -n1)"; 383 | LinuxMirror=$(selectMirror "$Relese" "$DISTCheck" "$VER" "$tmpMirror") 384 | ListDIST="$(wget --no-check-certificate -qO- "$LinuxMirror/dir_sizes" |cut -f2 |grep '^[0-9]')" 385 | DIST="$(echo "$ListDIST" |grep "^$DISTCheck" |head -n1)" 386 | [[ -z "$DIST" ]] && { 387 | echo -ne '\nThe dists version not found in this mirror, Please check it! \n\n' 388 | bash $0 error; 389 | exit 1; 390 | } 391 | wget --no-check-certificate -qO- "$LinuxMirror/$DIST/os/$VER/.treeinfo" |grep -q 'general'; 392 | [[ $? != '0' ]] && { 393 | echo -ne "\nThe version not found in this mirror, Please change mirror try again! \n\n"; 394 | exit 1; 395 | } 396 | fi 397 | fi 398 | 399 | if [[ -z "$LinuxMirror" ]]; then 400 | echo -ne "\033[31mError! \033[0mInvaild mirror! \n" 401 | [ "$Relese" == 'Debian' ] && echo -en "\033[33mexample:\033[0m http://deb.debian.org/debian\n\n"; 402 | [ "$Relese" == 'Ubuntu' ] && echo -en "\033[33mexample:\033[0m http://archive.ubuntu.com/ubuntu\n\n"; 403 | [ "$Relese" == 'CentOS' ] && echo -en "\033[33mexample:\033[0m http://mirror.centos.org/centos\n\n"; 404 | bash $0 error; 405 | exit 1; 406 | fi 407 | 408 | if [[ "$SpikCheckDIST" == '0' ]]; then 409 | DistsList="$(wget --no-check-certificate -qO- "$LinuxMirror/dists/" |grep -o 'href=.*/"' |cut -d'"' -f2 |sed '/-\|old\|Debian\|experimental\|stable\|test\|sid\|devel/d' |grep '^[^/]' |sed -n '1h;1!H;$g;s/\n//g;s/\//\;/g;$p')"; 410 | for CheckDEB in `echo "$DistsList" |sed 's/;/\n/g'` 411 | do 412 | [[ "$CheckDEB" == "$DIST" ]] && FindDists='1' && break; 413 | done 414 | [[ "$FindDists" == '0' ]] && { 415 | echo -ne '\nThe dists version not found, Please check it! \n\n' 416 | bash $0 error; 417 | exit 1; 418 | } 419 | fi 420 | 421 | if [[ "$ddMode" == '1' ]]; then 422 | if [[ -n "$tmpURL" ]]; then 423 | DDURL="$tmpURL" 424 | echo "$DDURL" |grep -q '^http://\|^ftp://\|^https://'; 425 | [[ $? -ne '0' ]] && echo 'Please input vaild URL,Only support http://, ftp:// and https:// !' && exit 1; 426 | else 427 | echo 'Please input vaild image URL! '; 428 | exit 1; 429 | fi 430 | fi 431 | 432 | clear && echo -e "\n\033[36m# Install\033[0m\n" 433 | 434 | [[ "$ddMode" == '1' ]] && echo -ne "\033[34mAuto Mode\033[0m insatll \033[33mcustom image\033[0m\n[\033[33m$DDURL\033[0m]\n" 435 | 436 | if [ -z "$interfaceSelect" ]; then 437 | if [[ "$linux_relese" == 'debian' ]] || [[ "$linux_relese" == 'ubuntu' ]]; then 438 | interfaceSelect="auto" 439 | elif [[ "$linux_relese" == 'centos' ]]; then 440 | interfaceSelect="link" 441 | fi 442 | fi 443 | 444 | if [[ "$linux_relese" == 'centos' ]]; then 445 | if [[ "$DIST" != "$UNVER" ]]; then 446 | awk 'BEGIN{print '${UNVER}'-'${DIST}'}' |grep -q '^-' 447 | if [ $? != '0' ]; then 448 | UNKNOWHW='1'; 449 | echo -en "\033[33mThe version lower then \033[31m$UNVER\033[33m may not support in auto mode! \033[0m\n"; 450 | fi 451 | awk 'BEGIN{print '${UNVER}'-'${DIST}'+0.59}' |grep -q '^-' 452 | if [ $? == '0' ]; then 453 | echo -en "\n\033[31mThe version higher then \033[33m6.10 \033[31mis not support in current! \033[0m\n\n" 454 | exit 1; 455 | fi 456 | fi 457 | fi 458 | 459 | echo -e "\n[\033[33m$Relese\033[0m] [\033[33m$DIST\033[0m] [\033[33m$VER\033[0m] Downloading..." 460 | 461 | if [[ "$linux_relese" == 'debian' ]] || [[ "$linux_relese" == 'ubuntu' ]]; then 462 | [ "$DIST" == "focal" ] && legacy="legacy-" || legacy="" 463 | wget --no-check-certificate -qO '/tmp/initrd.img' "${LinuxMirror}/dists/${DIST}/main/installer-${VER}/current/${legacy}images/netboot/${linux_relese}-installer/${VER}/initrd.gz" 464 | [[ $? -ne '0' ]] && echo -ne "\033[31mError! \033[0mDownload 'initrd.img' for \033[33m$linux_relese\033[0m failed! \n" && exit 1 465 | wget --no-check-certificate -qO '/tmp/vmlinuz' "${LinuxMirror}/dists/${DIST}${inUpdate}/main/installer-${VER}/current/${legacy}images/netboot/${linux_relese}-installer/${VER}/linux" 466 | [[ $? -ne '0' ]] && echo -ne "\033[31mError! \033[0mDownload 'vmlinuz' for \033[33m$linux_relese\033[0m failed! \n" && exit 1 467 | MirrorHost="$(echo "$LinuxMirror" |awk -F'://|/' '{print $2}')"; 468 | MirrorFolder="$(echo "$LinuxMirror" |awk -F''${MirrorHost}'' '{print $2}')"; 469 | [ -n "$MirrorFolder" ] || MirrorFolder="/" 470 | elif [[ "$linux_relese" == 'centos' ]]; then 471 | wget --no-check-certificate -qO '/tmp/initrd.img' "${LinuxMirror}/${DIST}/os/${VER}/isolinux/initrd.img" 472 | [[ $? -ne '0' ]] && echo -ne "\033[31mError! \033[0mDownload 'initrd.img' for \033[33m$linux_relese\033[0m failed! \n" && exit 1 473 | wget --no-check-certificate -qO '/tmp/vmlinuz' "${LinuxMirror}/${DIST}/os/${VER}/isolinux/vmlinuz" 474 | [[ $? -ne '0' ]] && echo -ne "\033[31mError! \033[0mDownload 'vmlinuz' for \033[33m$linux_relese\033[0m failed! \n" && exit 1 475 | else 476 | bash $0 error; 477 | exit 1; 478 | fi 479 | if [[ "$linux_relese" == 'debian' ]]; then 480 | if [[ "$IncFirmware" == '1' ]]; then 481 | wget --no-check-certificate -qO '/tmp/firmware.cpio.gz' "http://cdimage.debian.org/cdimage/unofficial/non-free/firmware/${DIST}/current/firmware.cpio.gz" 482 | [[ $? -ne '0' ]] && echo -ne "\033[31mError! \033[0mDownload 'firmware' for \033[33m$linux_relese\033[0m failed! \n" && exit 1 483 | fi 484 | if [[ "$ddMode" == '1' ]]; then 485 | vKernel_udeb=$(wget --no-check-certificate -qO- "http://$DISTMirror/dists/$DIST/main/installer-$VER/current/images/udeb.list" |grep '^acpi-modules' |head -n1 |grep -o '[0-9]\{1,2\}.[0-9]\{1,2\}.[0-9]\{1,2\}-[0-9]\{1,2\}' |head -n1) 486 | [[ -z "vKernel_udeb" ]] && vKernel_udeb="4.19.0-17" 487 | fi 488 | fi 489 | 490 | if [[ "$loaderMode" == "0" ]]; then 491 | [[ ! -f "${GRUBDIR}/${GRUBFILE}" ]] && echo "Error! Not Found ${GRUBFILE}. " && exit 1; 492 | 493 | [[ ! -f "${GRUBDIR}/${GRUBFILE}.old" ]] && [[ -f "${GRUBDIR}/${GRUBFILE}.bak" ]] && mv -f "${GRUBDIR}/${GRUBFILE}.bak" "${GRUBDIR}/${GRUBFILE}.old"; 494 | mv -f "${GRUBDIR}/${GRUBFILE}" "${GRUBDIR}/${GRUBFILE}.bak"; 495 | [[ -f "${GRUBDIR}/${GRUBFILE}.old" ]] && cat "${GRUBDIR}/${GRUBFILE}.old" >"${GRUBDIR}/${GRUBFILE}" || cat "${GRUBDIR}/${GRUBFILE}.bak" >"${GRUBDIR}/${GRUBFILE}"; 496 | else 497 | GRUBVER='-1' 498 | fi 499 | 500 | [[ "$GRUBVER" == '0' ]] && { 501 | READGRUB='/tmp/grub.read' 502 | cat $GRUBDIR/$GRUBFILE |sed -n '1h;1!H;$g;s/\n/%%%%%%%/g;$p' |grep -om 1 'menuentry\ [^{]*{[^}]*}%%%%%%%' |sed 's/%%%%%%%/\n/g' >$READGRUB 503 | LoadNum="$(cat $READGRUB |grep -c 'menuentry ')" 504 | if [[ "$LoadNum" -eq '1' ]]; then 505 | cat $READGRUB |sed '/^$/d' >/tmp/grub.new; 506 | elif [[ "$LoadNum" -gt '1' ]]; then 507 | CFG0="$(awk '/menuentry /{print NR}' $READGRUB|head -n 1)"; 508 | CFG2="$(awk '/menuentry /{print NR}' $READGRUB|head -n 2 |tail -n 1)"; 509 | CFG1=""; 510 | for tmpCFG in `awk '/}/{print NR}' $READGRUB` 511 | do 512 | [ "$tmpCFG" -gt "$CFG0" -a "$tmpCFG" -lt "$CFG2" ] && CFG1="$tmpCFG"; 513 | done 514 | [[ -z "$CFG1" ]] && { 515 | echo "Error! read $GRUBFILE. "; 516 | exit 1; 517 | } 518 | 519 | sed -n "$CFG0,$CFG1"p $READGRUB >/tmp/grub.new; 520 | [[ -f /tmp/grub.new ]] && [[ "$(grep -c '{' /tmp/grub.new)" -eq "$(grep -c '}' /tmp/grub.new)" ]] || { 521 | echo -ne "\033[31mError! \033[0mNot configure $GRUBFILE. \n"; 522 | exit 1; 523 | } 524 | fi 525 | [ ! -f /tmp/grub.new ] && echo "Error! $GRUBFILE. " && exit 1; 526 | sed -i "/menuentry.*/c\menuentry\ \'Install OS \[$DIST\ $VER\]\'\ --class debian\ --class\ gnu-linux\ --class\ gnu\ --class\ os\ \{" /tmp/grub.new 527 | sed -i "/echo.*Loading/d" /tmp/grub.new; 528 | INSERTGRUB="$(awk '/menuentry /{print NR}' $GRUBDIR/$GRUBFILE|head -n 1)" 529 | } 530 | 531 | [[ "$GRUBVER" == '1' ]] && { 532 | CFG0="$(awk '/title[\ ]|title[\t]/{print NR}' $GRUBDIR/$GRUBFILE|head -n 1)"; 533 | CFG1="$(awk '/title[\ ]|title[\t]/{print NR}' $GRUBDIR/$GRUBFILE|head -n 2 |tail -n 1)"; 534 | [[ -n $CFG0 ]] && [ -z $CFG1 -o $CFG1 == $CFG0 ] && sed -n "$CFG0,$"p $GRUBDIR/$GRUBFILE >/tmp/grub.new; 535 | [[ -n $CFG0 ]] && [ -z $CFG1 -o $CFG1 != $CFG0 ] && sed -n "$CFG0,$[$CFG1-1]"p $GRUBDIR/$GRUBFILE >/tmp/grub.new; 536 | [[ ! -f /tmp/grub.new ]] && echo "Error! configure append $GRUBFILE. " && exit 1; 537 | sed -i "/title.*/c\title\ \'Install OS \[$DIST\ $VER\]\'" /tmp/grub.new; 538 | sed -i '/^#/d' /tmp/grub.new; 539 | INSERTGRUB="$(awk '/title[\ ]|title[\t]/{print NR}' $GRUBDIR/$GRUBFILE|head -n 1)" 540 | } 541 | 542 | if [[ "$loaderMode" == "0" ]]; then 543 | [[ -n "$(grep 'linux.*/\|kernel.*/' /tmp/grub.new |awk '{print $2}' |tail -n 1 |grep '^/boot/')" ]] && Type='InBoot' || Type='NoBoot'; 544 | 545 | LinuxKernel="$(grep 'linux.*/\|kernel.*/' /tmp/grub.new |awk '{print $1}' |head -n 1)"; 546 | [[ -z "$LinuxKernel" ]] && echo "Error! read grub config! " && exit 1; 547 | LinuxIMG="$(grep 'initrd.*/' /tmp/grub.new |awk '{print $1}' |tail -n 1)"; 548 | [ -z "$LinuxIMG" ] && sed -i "/$LinuxKernel.*\//a\\\tinitrd\ \/" /tmp/grub.new && LinuxIMG='initrd'; 549 | 550 | [[ "$setInterfaceName" == "1" ]] && Add_OPTION="net.ifnames=0 biosdevname=0" || Add_OPTION="" 551 | [[ "$setIPv6" == "1" ]] && Add_OPTION="$Add_OPTION ipv6.disable=1" 552 | 553 | lowMem || Add_OPTION="$Add_OPTION lowmem=+0" 554 | 555 | if [[ "$linux_relese" == 'debian' ]] || [[ "$linux_relese" == 'ubuntu' ]]; then 556 | BOOT_OPTION="auto=true $Add_OPTION hostname=$linux_relese domain=$linux_relese quiet" 557 | elif [[ "$linux_relese" == 'centos' ]]; then 558 | BOOT_OPTION="ks=file://ks.cfg $Add_OPTION ksdevice=$interfaceSelect" 559 | fi 560 | 561 | [ -n "$setConsole" ] && BOOT_OPTION="$BOOT_OPTION --- console=$setConsole" 562 | 563 | [[ "$Type" == 'InBoot' ]] && { 564 | sed -i "/$LinuxKernel.*\//c\\\t$LinuxKernel\\t\/boot\/vmlinuz $BOOT_OPTION" /tmp/grub.new; 565 | sed -i "/$LinuxIMG.*\//c\\\t$LinuxIMG\\t\/boot\/initrd.img" /tmp/grub.new; 566 | } 567 | 568 | [[ "$Type" == 'NoBoot' ]] && { 569 | sed -i "/$LinuxKernel.*\//c\\\t$LinuxKernel\\t\/vmlinuz $BOOT_OPTION" /tmp/grub.new; 570 | sed -i "/$LinuxIMG.*\//c\\\t$LinuxIMG\\t\/initrd.img" /tmp/grub.new; 571 | } 572 | 573 | sed -i '$a\\n' /tmp/grub.new; 574 | 575 | sed -i ''${INSERTGRUB}'i\\n' $GRUBDIR/$GRUBFILE; 576 | sed -i ''${INSERTGRUB}'r /tmp/grub.new' $GRUBDIR/$GRUBFILE; 577 | [[ -f $GRUBDIR/grubenv ]] && sed -i 's/saved_entry/#saved_entry/g' $GRUBDIR/grubenv; 578 | fi 579 | 580 | [[ -d /tmp/boot ]] && rm -rf /tmp/boot; 581 | mkdir -p /tmp/boot; 582 | cd /tmp/boot; 583 | 584 | if [[ "$linux_relese" == 'debian' ]] || [[ "$linux_relese" == 'ubuntu' ]]; then 585 | COMPTYPE="gzip"; 586 | elif [[ "$linux_relese" == 'centos' ]]; then 587 | COMPTYPE="$(file ../initrd.img |grep -o ':.*compressed data' |cut -d' ' -f2 |sed -r 's/(.*)/\L\1/' |head -n1)" 588 | [[ -z "$COMPTYPE" ]] && echo "Detect compressed type fail." && exit 1; 589 | fi 590 | CompDected='0' 591 | for COMP in `echo -en 'gzip\nlzma\nxz'` 592 | do 593 | if [[ "$COMPTYPE" == "$COMP" ]]; then 594 | CompDected='1' 595 | if [[ "$COMPTYPE" == 'gzip' ]]; then 596 | NewIMG="initrd.img.gz" 597 | else 598 | NewIMG="initrd.img.$COMPTYPE" 599 | fi 600 | mv -f "/tmp/initrd.img" "/tmp/$NewIMG" 601 | break; 602 | fi 603 | done 604 | [[ "$CompDected" != '1' ]] && echo "Detect compressed type not support." && exit 1; 605 | [[ "$COMPTYPE" == 'lzma' ]] && UNCOMP='xz --format=lzma --decompress'; 606 | [[ "$COMPTYPE" == 'xz' ]] && UNCOMP='xz --decompress'; 607 | [[ "$COMPTYPE" == 'gzip' ]] && UNCOMP='gzip -d'; 608 | 609 | $UNCOMP < /tmp/$NewIMG | cpio --extract --verbose --make-directories --no-absolute-filenames >>/dev/null 2>&1 610 | 611 | if [[ "$linux_relese" == 'debian' ]] || [[ "$linux_relese" == 'ubuntu' ]]; then 612 | cat >/tmp/boot/preseed.cfg</dev/null |base64 -d >/tmp/run.sh; rm -rf /etc/run.sh; sed -i /^@reboot/d /etc/crontab; bash /tmp/run.sh' >>/target/etc/crontab; \ 690 | echo '' >>/target/etc/crontab; \ 691 | echo '${setCMD}' >/target/etc/run.sh; 692 | EOF 693 | 694 | if [[ "$loaderMode" != "0" ]] && [[ "$setNet" == '0' ]]; then 695 | sed -i '/netcfg\/disable_autoconfig/d' /tmp/boot/preseed.cfg 696 | sed -i '/netcfg\/dhcp_options/d' /tmp/boot/preseed.cfg 697 | sed -i '/netcfg\/get_.*/d' /tmp/boot/preseed.cfg 698 | sed -i '/netcfg\/confirm_static/d' /tmp/boot/preseed.cfg 699 | fi 700 | 701 | if [[ "$linux_relese" == 'debian' ]]; then 702 | sed -i '/user-setup\/allow-password-weak/d' /tmp/boot/preseed.cfg 703 | sed -i '/user-setup\/encrypt-home/d' /tmp/boot/preseed.cfg 704 | sed -i '/pkgsel\/update-policy/d' /tmp/boot/preseed.cfg 705 | sed -i 's/umount\ \/media.*true\;\ //g' /tmp/boot/preseed.cfg 706 | [[ -f '/tmp/firmware.cpio.gz' ]] && gzip -d < /tmp/firmware.cpio.gz | cpio --extract --verbose --make-directories --no-absolute-filenames >>/dev/null 2>&1 707 | else 708 | sed -i '/d-i\ grub-installer\/force-efi-extra-removable/d' /tmp/boot/preseed.cfg 709 | fi 710 | 711 | [[ "$ddMode" == '1' ]] && { 712 | WinNoDHCP(){ 713 | echo -ne "for\0040\0057f\0040\0042tokens\00753\0052\0042\0040\0045\0045i\0040in\0040\0050\0047netsh\0040interface\0040show\0040interface\0040\0136\0174more\0040\00533\0040\0136\0174findstr\0040\0057I\0040\0057R\0040\0042本地\0056\0052\0040以太\0056\0052\0040Local\0056\0052\0040Ethernet\0042\0047\0051\0040do\0040\0050set\0040EthName\0075\0045\0045j\0051\r\nnetsh\0040\0055c\0040interface\0040ip\0040set\0040address\0040name\0075\0042\0045EthName\0045\0042\0040source\0075static\0040address\0075$IPv4\0040mask\0075$MASK\0040gateway\0075$GATE\r\nnetsh\0040\0055c\0040interface\0040ip\0040add\0040dnsservers\0040name\0075\0042\0045EthName\0045\0042\0040address\00758\00568\00568\00568\0040index\00751\0040validate\0075no\r\n\r\n" >>'/tmp/boot/net.tmp'; 714 | } 715 | WinRDP(){ 716 | echo -ne "netsh\0040firewall\0040set\0040portopening\0040protocol\0075ALL\0040port\0075$WinRemote\0040name\0075RDP\0040mode\0075ENABLE\0040scope\0075ALL\0040profile\0075ALL\r\nnetsh\0040firewall\0040set\0040portopening\0040protocol\0075ALL\0040port\0075$WinRemote\0040name\0075RDP\0040mode\0075ENABLE\0040scope\0075ALL\0040profile\0075CURRENT\r\nreg\0040add\0040\0042HKLM\0134SYSTEM\0134CurrentControlSet\0134Control\0134Network\0134NewNetworkWindowOff\0042\0040\0057f\r\nreg\0040add\0040\0042HKLM\0134SYSTEM\0134CurrentControlSet\0134Control\0134Terminal\0040Server\0042\0040\0057v\0040fDenyTSConnections\0040\0057t\0040reg\0137dword\0040\0057d\00400\0040\0057f\r\nreg\0040add\0040\0042HKLM\0134SYSTEM\0134CurrentControlSet\0134Control\0134Terminal\0040Server\0134Wds\0134rdpwd\0134Tds\0134tcp\0042\0040\0057v\0040PortNumber\0040\0057t\0040reg\0137dword\0040\0057d\0040$WinRemote\0040\0057f\r\nreg\0040add\0040\0042HKLM\0134SYSTEM\0134CurrentControlSet\0134Control\0134Terminal\0040Server\0134WinStations\0134RDP\0055Tcp\0042\0040\0057v\0040PortNumber\0040\0057t\0040reg\0137dword\0040\0057d\0040$WinRemote\0040\0057f\r\nreg\0040add\0040\0042HKLM\0134SYSTEM\0134CurrentControlSet\0134Control\0134Terminal\0040Server\0134WinStations\0134RDP\0055Tcp\0042\0040\0057v\0040UserAuthentication\0040\0057t\0040reg\0137dword\0040\0057d\00400\0040\0057f\r\nFOR\0040\0057F\0040\0042tokens\00752\0040delims\0075\0072\0042\0040\0045\0045i\0040in\0040\0050\0047SC\0040QUERYEX\0040TermService\0040\0136\0174FINDSTR\0040\0057I\0040\0042PID\0042\0047\0051\0040do\0040TASKKILL\0040\0057F\0040\0057PID\0040\0045\0045i\r\nFOR\0040\0057F\0040\0042tokens\00752\0040delims\0075\0072\0042\0040\0045\0045i\0040in\0040\0050\0047SC\0040QUERYEX\0040UmRdpService\0040\0136\0174FINDSTR\0040\0057I\0040\0042PID\0042\0047\0051\0040do\0040TASKKILL\0040\0057F\0040\0057PID\0040\0045\0045i\r\nSC\0040START\0040TermService\r\n\r\n" >>'/tmp/boot/net.tmp'; 717 | } 718 | echo -ne "\0100ECHO\0040OFF\r\n\r\ncd\0056\0076\0045WINDIR\0045\0134GetAdmin\r\nif\0040exist\0040\0045WINDIR\0045\0134GetAdmin\0040\0050del\0040\0057f\0040\0057q\0040\0042\0045WINDIR\0045\0134GetAdmin\0042\0051\0040else\0040\0050\r\necho\0040CreateObject\0136\0050\0042Shell\0056Application\0042\0136\0051\0056ShellExecute\0040\0042\0045\0176s0\0042\0054\0040\0042\0045\0052\0042\0054\0040\0042\0042\0054\0040\0042runas\0042\0054\00401\0040\0076\0076\0040\0042\0045temp\0045\0134Admin\0056vbs\0042\r\n\0042\0045temp\0045\0134Admin\0056vbs\0042\r\ndel\0040\0057f\0040\0057q\0040\0042\0045temp\0045\0134Admin\0056vbs\0042\r\nexit\0040\0057b\00402\0051\r\n\r\n" >'/tmp/boot/net.tmp'; 719 | [[ "$setNet" == '1' ]] && WinNoDHCP; 720 | [[ "$setNet" == '0' ]] && [[ "$AutoNet" == '0' ]] && WinNoDHCP; 721 | [[ "$setRDP" == '1' ]] && [[ -n "$WinRemote" ]] && WinRDP 722 | echo -ne "ECHO\0040SELECT\0040VOLUME\0075\0045\0045SystemDrive\0045\0045\0040\0076\0040\0042\0045SystemDrive\0045\0134diskpart\0056extend\0042\r\nECHO\0040EXTEND\0040\0076\0076\0040\0042\0045SystemDrive\0045\0134diskpart\0056extend\0042\r\nSTART\0040/WAIT\0040DISKPART\0040\0057S\0040\0042\0045SystemDrive\0045\0134diskpart\0056extend\0042\r\nDEL\0040\0057f\0040\0057q\0040\0042\0045SystemDrive\0045\0134diskpart\0056extend\0042\r\n\r\n" >>'/tmp/boot/net.tmp'; 723 | echo -ne "cd\0040\0057d\0040\0042\0045ProgramData\0045\0057Microsoft\0057Windows\0057Start\0040Menu\0057Programs\0057Startup\0042\r\ndel\0040\0057f\0040\0057q\0040net\0056bat\r\n\r\n\r\n" >>'/tmp/boot/net.tmp'; 724 | iconv -f 'UTF-8' -t 'GBK' '/tmp/boot/net.tmp' -o '/tmp/boot/net.bat' 725 | rm -rf '/tmp/boot/net.tmp' 726 | } 727 | 728 | [[ "$ddMode" == '0' ]] && { 729 | sed -i '/anna-install/d' /tmp/boot/preseed.cfg 730 | sed -i 's/wget.*\/sbin\/reboot\;\ //g' /tmp/boot/preseed.cfg 731 | } 732 | 733 | elif [[ "$linux_relese" == 'centos' ]]; then 734 | cat >/tmp/boot/ks.cfg< /tmp/initrd.img; 776 | cp -f /tmp/initrd.img /boot/initrd.img || sudo cp -f /tmp/initrd.img /boot/initrd.img 777 | cp -f /tmp/vmlinuz /boot/vmlinuz || sudo cp -f /tmp/vmlinuz /boot/vmlinuz 778 | 779 | chown root:root $GRUBDIR/$GRUBFILE 780 | chmod 444 $GRUBDIR/$GRUBFILE 781 | 782 | if [[ "$loaderMode" == "0" ]]; then 783 | sleep 3 && reboot || sudo reboot >/dev/null 2>&1 784 | else 785 | rm -rf "$HOME/loader" 786 | mkdir -p "$HOME/loader" 787 | cp -rf "/boot/initrd.img" "$HOME/loader/initrd.img" 788 | cp -rf "/boot/vmlinuz" "$HOME/loader/vmlinuz" 789 | [[ -f "/boot/initrd.img" ]] && rm -rf "/boot/initrd.img" 790 | [[ -f "/boot/vmlinuz" ]] && rm -rf "/boot/vmlinuz" 791 | echo && ls -AR1 "$HOME/loader" 792 | fi 793 | 794 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /LVM_Auto_Partition.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo " " 4 | echo "######################################################" 5 | echo "# " 6 | echo "# LVM Auto Partition Tool " 7 | echo "# " 8 | echo "# Author: hiCasper " 9 | echo "# Blog: https://blog.hicasper.com " 10 | echo "# Last Modified: 2019-06-22 " 11 | echo "# " 12 | echo "# Supported by https://github.com/MeowLove " 13 | echo "# " 14 | echo "######################################################" 15 | echo " " 16 | 17 | DISK=`fdisk -l | grep -o /dev/*da | head -1` 18 | PART=$DISK"3" 19 | VGNAME=`lvdisplay | grep "VG Name" | awk ' ''{print $3}'` 20 | LVNAME=`lvdisplay | grep "LV Name" | awk ' ''{print $3}'` 21 | 22 | echo "Creating new partition..." 23 | echo "n 24 | p 25 | 3 26 | 27 | 28 | t 29 | 3 30 | 8e 31 | w 32 | " | fdisk $DISK 33 | sleep 10s 34 | 35 | partprobe 36 | sleep 20s 37 | 38 | echo "Creating PV..." 39 | pvcreate $PART 40 | sleep 10s 41 | 42 | echo "Extending VG..." 43 | vgextend $VGNAME $PART 44 | sleep 10s 45 | 46 | echo "Extending LV..." 47 | lvextend -l +100%FREE /dev/mapper/$VGNAME-$LVNAME 48 | sleep 10s 49 | 50 | echo "Resizing volume..." 51 | resize2fs -p /dev/mapper/$VGNAME-$LVNAME 52 | sleep 6s 53 | 54 | if [ -f "/etc/profile.d/hint.sh" ]; then 55 | rm -f /etc/profile.d/hint.sh 56 | fi 57 | 58 | echo "Done! Please restart your server." 59 | -------------------------------------------------------------------------------- /clearlog.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # CentOS 7 ONLY 4 | 5 | service rsyslog stop 6 | cd /var/log 7 | 8 | >boot.log 9 | >cron 10 | >dmesg 11 | >dmesg.old 12 | >maillog 13 | >spooler 14 | >wtmp 15 | >btmp 16 | >lastlog 17 | >messages 18 | >secure 19 | >tallylog 20 | 21 | rm -f ~/.bash_history 22 | history -cw && shutdown -h now -------------------------------------------------------------------------------- /config/qbittorrent/4.2.5.conf: -------------------------------------------------------------------------------- 1 | [AutoRun] 2 | enabled=false 3 | program= 4 | 5 | [BitTorrent] 6 | Session\AsyncIOThreadsCount=8 7 | Session\FilePoolSize=500 8 | Session\MultiConnectionsPerIp=true 9 | Session\SlowTorrentsDownloadRate=50 10 | Session\SlowTorrentsUploadRate=50 11 | Session\SocketBacklogSize=100 12 | Session\SuggestMode=true 13 | 14 | [LegalNotice] 15 | Accepted=true 16 | 17 | [Preferences] 18 | Advanced\IncludeOverhead=true 19 | Advanced\RecheckOnCompletion=false 20 | Advanced\trackerPort=9000 21 | Bittorrent\DHT=false 22 | Bittorrent\LSD=false 23 | Bittorrent\MaxConnecs=1024 24 | Bittorrent\MaxConnecsPerTorrent=128 25 | Bittorrent\MaxUploads=64 26 | Bittorrent\MaxUploadsPerTorrent=-1 27 | Bittorrent\PeX=false 28 | Connection\GlobalUPLimit=20000 29 | Connection\PortRangeMin=11413 30 | Connection\ResolvePeerCountries=true 31 | Connection\UPnP=false 32 | Downloads\DiskWriteCacheSize=64 33 | Downloads\DiskWriteCacheTTL=30 34 | Downloads\PreAllocation=true 35 | Downloads\ScanDirsV2=@Variant(\0\0\0\x1c\0\0\0\0) 36 | Downloads\StartInPause=true 37 | DynDNS\DomainName=changeme.dyndns.org 38 | DynDNS\Enabled=false 39 | DynDNS\Password= 40 | DynDNS\Service=0 41 | DynDNS\Username= 42 | General\Locale=zh 43 | General\UseRandomPort=true 44 | MailNotification\email= 45 | MailNotification\enabled=false 46 | MailNotification\password= 47 | MailNotification\req_auth=true 48 | MailNotification\req_ssl=false 49 | MailNotification\sender= 50 | MailNotification\smtp_server= 51 | MailNotification\username= 52 | Queueing\IgnoreSlowTorrents=true 53 | Queueing\MaxActiveDownloads=8 54 | Queueing\MaxActiveTorrents=-1 55 | Queueing\MaxActiveUploads=-1 56 | Queueing\QueueingEnabled=true 57 | WebUI\Address=* 58 | WebUI\AlternativeUIEnabled=false 59 | WebUI\AuthSubnetWhitelist=@Invalid() 60 | WebUI\AuthSubnetWhitelistEnabled=false 61 | WebUI\BanDuration=3600 62 | WebUI\CSRFProtection=false 63 | WebUI\ClickjackingProtection=true 64 | WebUI\CustomHTTPHeaders= 65 | WebUI\CustomHTTPHeadersEnabled=false 66 | WebUI\HTTPS\CertificatePath= 67 | WebUI\HTTPS\Enabled=false 68 | WebUI\HTTPS\KeyPath= 69 | WebUI\HostHeaderValidation=true 70 | WebUI\LocalHostAuth=false 71 | WebUI\MaxAuthenticationFailCount=3 72 | WebUI\Password_PBKDF2="@ByteArray(XpIr0Se8MjmSg5pIAIm/5A==:N/1ZsQ99XkaRLkleHZZSVqzYaVjPyhWFyzzvnjuotGm2rs+q/6pthwktHA6X3bPyyDcAM6nJH1g9xqOapv+mdg==)" 73 | WebUI\Port=WEBPORT 74 | WebUI\RootFolder= 75 | WebUI\SecureCookie=true 76 | WebUI\ServerDomains=* 77 | WebUI\SessionTimeout=3600 78 | WebUI\UseUPnP=false 79 | WebUI\Username=QBUSER -------------------------------------------------------------------------------- /config/qbittorrent/4.3.9.conf: -------------------------------------------------------------------------------- 1 | [AutoRun] 2 | enabled=false 3 | program= 4 | 5 | [BitTorrent] 6 | Session\AsyncIOThreadsCount=8 7 | Session\BTProtocol=TCP 8 | Session\BlockPeersOnPrivilegedPorts=false 9 | Session\CoalesceReadWrite=true 10 | Session\FilePoolSize=500 11 | Session\MultiConnectionsPerIp=true 12 | Session\SSRFMitigation=false 13 | Session\SlowTorrentsDownloadRate=50 14 | Session\SlowTorrentsUploadRate=50 15 | Session\SuggestMode=true 16 | Session\TorrentContentLayout=Subfolder 17 | Session\ValidateHTTPSTrackerCertificate=false 18 | 19 | [Core] 20 | AutoDeleteAddedTorrentFile=Never 21 | 22 | [LegalNotice] 23 | Accepted=true 24 | 25 | [Preferences] 26 | Advanced\IncludeOverhead=true 27 | Advanced\RecheckOnCompletion=false 28 | Advanced\trackerPort=9000 29 | Bittorrent\DHT=false 30 | Bittorrent\LSD=false 31 | Bittorrent\MaxConnecs=1024 32 | Bittorrent\MaxConnecsPerTorrent=64 33 | Bittorrent\MaxUploads=64 34 | Bittorrent\MaxUploadsPerTorrent=-1 35 | Bittorrent\PeX=false 36 | Connection\PortRangeMin=30000 37 | Connection\ResolvePeerCountries=true 38 | Connection\UPnP=false 39 | Downloads\DiskWriteCacheSize=64 40 | Downloads\DiskWriteCacheTTL=30 41 | Downloads\PreAllocation=true 42 | Downloads\StartInPause=true 43 | DynDNS\DomainName=changeme.dyndns.org 44 | DynDNS\Enabled=false 45 | DynDNS\Password= 46 | DynDNS\Service=0 47 | DynDNS\Username= 48 | General\Locale=zh 49 | General\UseRandomPort=true 50 | MailNotification\email= 51 | MailNotification\enabled=false 52 | MailNotification\password= 53 | MailNotification\req_auth=true 54 | MailNotification\req_ssl=false 55 | MailNotification\sender= 56 | MailNotification\smtp_server= 57 | MailNotification\username= 58 | Queueing\IgnoreSlowTorrents=true 59 | Queueing\MaxActiveDownloads=8 60 | Queueing\MaxActiveTorrents=-1 61 | Queueing\MaxActiveUploads=-1 62 | Queueing\QueueingEnabled=true 63 | WebUI\Address=* 64 | WebUI\AlternativeUIEnabled=false 65 | WebUI\AuthSubnetWhitelist=@Invalid() 66 | WebUI\AuthSubnetWhitelistEnabled=false 67 | WebUI\BanDuration=3600 68 | WebUI\CSRFProtection=false 69 | WebUI\ClickjackingProtection=true 70 | WebUI\CustomHTTPHeaders= 71 | WebUI\CustomHTTPHeadersEnabled=false 72 | WebUI\HTTPS\CertificatePath= 73 | WebUI\HTTPS\Enabled=false 74 | WebUI\HTTPS\KeyPath= 75 | WebUI\HostHeaderValidation=true 76 | WebUI\LocalHostAuth=true 77 | WebUI\MaxAuthenticationFailCount=5 78 | WebUI\Password_PBKDF2="@ByteArray(FM+rly9CcCqI/z3U1x/eLA==:OolOfFAYA1voPVzluk60VjYK5m4NTnnZR6Fygb0Kuy+et6CdeEiMJHNvwigRdcGYFz1RAHJ8KbfirpbzuP3E8g==)" 79 | WebUI\Port=WEBPORT 80 | WebUI\RootFolder= 81 | WebUI\SecureCookie=true 82 | WebUI\ServerDomains=* 83 | WebUI\SessionTimeout=3600 84 | WebUI\UseUPnP=false 85 | WebUI\Username=QBUSER 86 | 87 | [RSS] 88 | AutoDownloader\DownloadRepacks=false 89 | AutoDownloader\SmartEpisodeFilter=s(\\d+)e(\\d+), (\\d+)x(\\d+), "(\\d{4}[.\\-]\\d{1,2}[.\\-]\\d{1,2})", "(\\d{1,2}[.\\-]\\d{1,2}[.\\-]\\d{4})" 90 | -------------------------------------------------------------------------------- /config/qbittorrent/systemd.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=qBittorrent-nox Service 3 | Wants=network.target 4 | After=network.target 5 | 6 | [Service] 7 | Type=simple 8 | User=RUNUSER 9 | # The -d flag should not be used in this setup 10 | ExecStart=/usr/local/bin/qbittorrent-nox 11 | Restart=on-failure 12 | SyslogIdentifier=qbittorrent-nox 13 | 14 | [Install] 15 | WantedBy=multi-user.target -------------------------------------------------------------------------------- /docker.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | [[ "$EUID" -ne '0' ]] && echo "Error:This script must be run as root!" && exit 1; 4 | if [[ -f "/usr/bin/yum" && -f "/etc/selinux/config" ]]; then 5 | setenforce 0 6 | sed -i 's/^SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config 7 | fi 8 | 9 | while [ $# -gt 0 ]; do 10 | case $1 in 11 | uninstall) 12 | UNINST=1 13 | ;; 14 | -v|--version) 15 | VER=$2 16 | shift 17 | ;; 18 | *) 19 | echo "Unknown option: \"$1\"" 20 | exit 21 | esac 22 | shift 23 | done 24 | 25 | if [ "$UNINST" == '1' ]; then 26 | if [ -f "/usr/bin/apt-get" ]; then 27 | apt-get remove docker docker-engine docker.io containerd runc 28 | fi 29 | if [ -f "/usr/bin/yum" ]; then 30 | yum remove docker docker-client docker-client-latest docker-common docker-latest docker-latest-logrotate docker-logrotate docker-selinux docker-engine-selinux docker-engine 31 | fi 32 | echo Uninstall done! 33 | exit 34 | fi 35 | 36 | COUNTRY=$(curl -fsSL http://ipinfo.io | grep -o '"country": "[^"]*' | grep -o '[^"]*$') 37 | 38 | REPO='https://download.docker.com' 39 | if [ "$COUNTRY" == 'CN' ]; then 40 | REPO='https://mirrors.aliyun.com/docker-ce' 41 | fi 42 | 43 | if [ -f "/usr/bin/apt-get" ]; then 44 | isDebian=$(cat /etc/issue | grep Debian) 45 | apt-get remove docker docker-engine docker.io containerd runc 46 | apt-get install apt-transport-https ca-certificates curl gnupg2 software-properties-common 47 | if [ -z "$isDebian" ]; then 48 | curl -fsSL $REPO/linux/debian/gpg | apt-key add - 49 | add-apt-repository "deb [arch=amd64] $REPO/linux/debian $(lsb_release -cs) stable" 50 | else 51 | curl -fsSL $REPO/linux/ubuntu/gpg | apt-key add - 52 | add-apt-repository "deb [arch=amd64] $REPO/linux/ubuntu $(lsb_release -cs) stable" 53 | fi 54 | apt-get install docker-ce 55 | fi 56 | 57 | case "$VER" in 58 | "1809") RPMS='docker-ce-18.09.9 docker-ce-cli-18.09.9 containerd.io-1.2.13' ;; 59 | "1903") RPMS='docker-ce-19.03.15 docker-ce-cli-19.03.15 containerd.io-1.3.9' ;; 60 | "2010") RPMS='docker-ce-20.10.24 docker-ce-cli-20.10.24 docker-ce-rootless-extras-20.10.24 containerd.io-1.6.20 docker-compose-plugin-2.15.1' ;; 61 | *) RPMS='docker-ce docker-ce-cli containerd.io docker-compose-plugin' ;; 62 | esac 63 | 64 | if [ -f "/usr/bin/yum" ]; then 65 | yum remove docker docker-client docker-client-latest docker-common docker-latest docker-latest-logrotate docker-logrotate docker-selinux docker-engine-selinux docker-engine 66 | yum install -y yum-utils 67 | if [ "$VER" == "1809" ] || [ "$VER" == "1903" ] ; then 68 | yum install -y device-mapper-persistent-data 69 | fi 70 | yum-config-manager --add-repo $REPO/linux/centos/docker-ce.repo 71 | yum install -y $RPMS 72 | fi 73 | 74 | systemctl start docker 75 | if [ "$COUNTRY" == 'CN' ]; then 76 | cat > /etc/docker/daemon.json < /etc/docker/daemon.json </etc/docker/daemon.json</etc/docker/daemon.json</dev/null || echo -1` -eq -1 ]; then 32 | useradd -U -m $RUNUSER 33 | usermod -a -G $RUNUSER $RUNUSER 34 | fi 35 | HOMEDIR="/home/$RUNUSER" 36 | fi 37 | 38 | mkdir /tmp/filebrowser 39 | wget -O /tmp/filebrowser/linux-amd64-filebrowser.tar.gz https://github.com/filebrowser/filebrowser/releases/latest/download/linux-amd64-filebrowser.tar.gz 40 | tar xvzf /tmp/filebrowser/linux-amd64-filebrowser.tar.gz -C /tmp/filebrowser 41 | cp -f /tmp/filebrowser/filebrowser /usr/local/bin/filebrowser 42 | chmod +x /usr/local/bin/filebrowser 43 | rm -rf /tmp/filebrowser 44 | 45 | /usr/local/bin/filebrowser -d /etc/filebrowser/filebrowser.db config init 46 | /usr/local/bin/filebrowser -d /etc/filebrowser/filebrowser.db config set --address $FBADDR 47 | /usr/local/bin/filebrowser -d /etc/filebrowser/filebrowser.db config set --port $FBPORT 48 | /usr/local/bin/filebrowser -d /etc/filebrowser/filebrowser.db config set --locale $FBLANG 49 | /usr/local/bin/filebrowser -d /etc/filebrowser/filebrowser.db config set -r $HOMEDIR 50 | /usr/local/bin/filebrowser -d /etc/filebrowser/filebrowser.db config set --log /var/log/filebrowser.log 51 | /usr/local/bin/filebrowser -d /etc/filebrowser/filebrowser.db users add $FBUSER $FBPASS --perm.admin 52 | 53 | chown -R $RUNUSER:$RUNUSER /etc/filebrowser 54 | 55 | cat > /etc/systemd/system/filebrowser.service </dev/null || echo -1` -eq -1 ]; then 35 | useradd -U -m $RUNUSER 36 | usermod -a -G $RUNUSER $RUNUSER 37 | fi 38 | HOMEDIR="/home/$RUNUSER" 39 | fi 40 | 41 | case $VER in 42 | '4.2.5') URL='https://github.com/Aniverse/qbittorrent-nox-static/releases/download/4.2.4/qbittorrent-nox.4.2.5.lt.1.2.6' ;; 43 | '4.3.9') URL='https://github.com/userdocs/qbittorrent-nox-static/releases/download/release-4.3.9_v1.2.15/x86_64-qbittorrent-nox' ;; 44 | *) URL='https://github.com/userdocs/qbittorrent-nox-static/releases/latest/download/x86_64-qbittorrent-nox' ;; 45 | esac 46 | 47 | wget -O /usr/local/bin/qbittorrent-nox $URL 48 | chmod +x /usr/local/bin/qbittorrent-nox 49 | 50 | if [ ! -d "$HOMEDIR/.config/qBittorrent" ]; then 51 | mkdir -p $HOMEDIR/.config/qBittorrent 52 | fi 53 | 54 | wget -O /etc/systemd/system/qbittorrent.service $CONFURL/systemd.service 55 | sed -i "s/RUNUSER/${RUNUSER}/" /etc/systemd/system/qbittorrent.service 56 | 57 | if [ ! -z "$VER" ]; then 58 | wget -O $HOMEDIR/.config/qBittorrent/qBittorrent.conf $CONFURL/$VER.conf 59 | sed -i "s/QBUSER/${QBUSER}/" $HOMEDIR/.config/qBittorrent/qBittorrent.conf 60 | sed -i "s/WEBPORT/${WEBPORT}/" $HOMEDIR/.config/qBittorrent/qBittorrent.conf 61 | else 62 | echo -e "[LegalNotice]\nAccepted=true" > $HOMEDIR/.config/qBittorrent/qBittorrent.conf 63 | fi 64 | 65 | if [ "$RUNUSER" != 'root' ]; then 66 | chown -R $RUNUSER:$RUNUSER $HOMEDIR/.config/qBittorrent 67 | fi 68 | 69 | systemctl daemon-reload && systemctl start qbittorrent.service 70 | systemctl enable qbittorrent.service 71 | -------------------------------------------------------------------------------- /wget_udeb_amd64.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hicasper/Shell/e045bdde9d3d3755a9610d0e89ca8a4844ba073b/wget_udeb_amd64.tar.gz --------------------------------------------------------------------------------