|
@@ -1,20 +1,21 @@
|
|
|
#!/bin/bash
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
|
|
+## License: GPL
|
|
|
## This is the magically modified version of the one-click reload script.
|
|
## This is the magically modified version of the one-click reload script.
|
|
|
## It can reinstall CentOS, Debian, Ubuntu and other Linux systems (continuously added) over the network in one click.
|
|
## It can reinstall CentOS, Debian, Ubuntu and other Linux systems (continuously added) over the network in one click.
|
|
|
## It can reinstall Windwos 2003, 7, 2008R2, 2012R2, 2016, 2019 and other Windows systems (continuously added) via the network in one click.
|
|
## It can reinstall Windwos 2003, 7, 2008R2, 2012R2, 2016, 2019 and other Windows systems (continuously added) via the network in one click.
|
|
|
-## Technical support is provided by the technical blog. (based on the original version of Vicer)
|
|
|
|
|
|
|
+## Support GRUB or GRUB2 for installing a clean minimal system.
|
|
|
|
|
+## Technical support is provided by the CXT (CXTHHHHH.com). (based on the original version of Vicer)
|
|
|
|
|
|
|
|
## Magic Modify version author:
|
|
## Magic Modify version author:
|
|
|
-## Support GRUB or GRUB2 for installing a clean minimal system.
|
|
|
|
|
## Default root password: cxthhhhh.com
|
|
## Default root password: cxthhhhh.com
|
|
|
-## Blog: https://tech.cxthhhhh.com
|
|
|
|
|
-## Written By Technical Blog
|
|
|
|
|
|
|
+## Blog: https://cxthhhhh.com
|
|
|
|
|
+## Written By CXT (CXTHHHHH.com)
|
|
|
|
|
|
|
|
## Original version author:
|
|
## Original version author:
|
|
|
-## Suitable for using by GRUB.
|
|
|
|
|
## Blog: https://moeclub.org
|
|
## Blog: https://moeclub.org
|
|
|
-## Written By Vicer
|
|
|
|
|
|
|
+## Written By Vicer (MoeClub.org)
|
|
|
|
|
+
|
|
|
|
|
|
|
|
export tmpVER=''
|
|
export tmpVER=''
|
|
|
export tmpDIST=''
|
|
export tmpDIST=''
|
|
@@ -23,18 +24,19 @@ export tmpWORD=''
|
|
|
export tmpMirror=''
|
|
export tmpMirror=''
|
|
|
export tmpSSL=''
|
|
export tmpSSL=''
|
|
|
export tmpINS=''
|
|
export tmpINS=''
|
|
|
-export tmpFW=''
|
|
|
|
|
export ipAddr=''
|
|
export ipAddr=''
|
|
|
export ipMask=''
|
|
export ipMask=''
|
|
|
export ipGate=''
|
|
export ipGate=''
|
|
|
-export linuxdists=''
|
|
|
|
|
|
|
+export Relese=''
|
|
|
export ddMode='0'
|
|
export ddMode='0'
|
|
|
export setNet='0'
|
|
export setNet='0'
|
|
|
export setRDP='0'
|
|
export setRDP='0'
|
|
|
|
|
+export setIPv6='0'
|
|
|
export isMirror='0'
|
|
export isMirror='0'
|
|
|
export FindDists='0'
|
|
export FindDists='0'
|
|
|
export loaderMode='0'
|
|
export loaderMode='0'
|
|
|
export SpikCheckDIST='0'
|
|
export SpikCheckDIST='0'
|
|
|
|
|
+export setInterfaceName='0'
|
|
|
export UNKNOWHW='0'
|
|
export UNKNOWHW='0'
|
|
|
export UNVER='6.4'
|
|
export UNVER='6.4'
|
|
|
|
|
|
|
@@ -47,19 +49,19 @@ while [[ $# -ge 1 ]]; do
|
|
|
;;
|
|
;;
|
|
|
-d|--debian)
|
|
-d|--debian)
|
|
|
shift
|
|
shift
|
|
|
- linuxdists='debian'
|
|
|
|
|
|
|
+ Relese='Debian'
|
|
|
tmpDIST="$1"
|
|
tmpDIST="$1"
|
|
|
shift
|
|
shift
|
|
|
;;
|
|
;;
|
|
|
-u|--ubuntu)
|
|
-u|--ubuntu)
|
|
|
shift
|
|
shift
|
|
|
- linuxdists='ubuntu'
|
|
|
|
|
|
|
+ Relese='Ubuntu'
|
|
|
tmpDIST="$1"
|
|
tmpDIST="$1"
|
|
|
shift
|
|
shift
|
|
|
;;
|
|
;;
|
|
|
-c|--centos)
|
|
-c|--centos)
|
|
|
shift
|
|
shift
|
|
|
- linuxdists='centos'
|
|
|
|
|
|
|
+ Relese='CentOS'
|
|
|
tmpDIST="$1"
|
|
tmpDIST="$1"
|
|
|
shift
|
|
shift
|
|
|
;;
|
|
;;
|
|
@@ -94,6 +96,10 @@ while [[ $# -ge 1 ]]; do
|
|
|
ipGate="$1"
|
|
ipGate="$1"
|
|
|
shift
|
|
shift
|
|
|
;;
|
|
;;
|
|
|
|
|
+ --dev-net)
|
|
|
|
|
+ shift
|
|
|
|
|
+ setInterfaceName='1'
|
|
|
|
|
+ ;;
|
|
|
--loader)
|
|
--loader)
|
|
|
shift
|
|
shift
|
|
|
loaderMode='1'
|
|
loaderMode='1'
|
|
@@ -128,13 +134,13 @@ while [[ $# -ge 1 ]]; do
|
|
|
tmpSSL="$1"
|
|
tmpSSL="$1"
|
|
|
shift
|
|
shift
|
|
|
;;
|
|
;;
|
|
|
- --firmware)
|
|
|
|
|
|
|
+ --ipv6)
|
|
|
shift
|
|
shift
|
|
|
- tmpFW='1'
|
|
|
|
|
|
|
+ setIPv6='1'
|
|
|
;;
|
|
;;
|
|
|
*)
|
|
*)
|
|
|
if [[ "$1" != 'error' ]]; then echo -ne "\nInvaild option: '$1'\n\n"; fi
|
|
if [[ "$1" != 'error' ]]; then echo -ne "\nInvaild option: '$1'\n\n"; fi
|
|
|
- echo -ne " Usage:\n\tbash DebianNET.sh\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[33m\033[04mdists-verison\033[0m]\n\t\t\t\t-v/--ver [32/\033[33m\033[04mi386\033[0m|64/amd64]\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-a/--auto\n\t\t\t\t-m/--manual\n"
|
|
|
|
|
|
|
+ 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[33m\033[04mdists-verison\033[0m]\n\t\t\t\t-v/--ver [32/\033[33m\033[04mi386\033[0m|64/amd64]\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-a/--auto\n\t\t\t\t-m/--manual\n"
|
|
|
exit 1;
|
|
exit 1;
|
|
|
;;
|
|
;;
|
|
|
esac
|
|
esac
|
|
@@ -171,69 +177,64 @@ if [ "$FullDependence" == '1' ]; then
|
|
|
fi
|
|
fi
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-if [[ -z "$linuxdists" ]]; then
|
|
|
|
|
- linuxdists='debian';
|
|
|
|
|
-fi
|
|
|
|
|
|
|
+function SelectMirror(){
|
|
|
|
|
+ [ $# -ge 3 ] || exit 1
|
|
|
|
|
+ Relese="$1"
|
|
|
|
|
+ DIST=$(echo "$2" |sed 's/\ //g' |sed -r 's/(.*)/\L\1/')
|
|
|
|
|
+ VER=$(echo "$3" |sed 's/\ //g' |sed -r 's/(.*)/\L\1/')
|
|
|
|
|
+ New=$(echo "$4" |sed 's/\ //g')
|
|
|
|
|
+ [ -n "$Relese" ] || exit 1
|
|
|
|
|
+ [ -n "$DIST" ] || exit 1
|
|
|
|
|
+ [ -n "$VER" ] || exit 1
|
|
|
|
|
+ relese=$(echo $Relese |sed -r 's/(.*)/\L\1/')
|
|
|
|
|
+ if [ "$Relese" == "Debian" ] || [ "$Relese" == "Ubuntu" ]; then
|
|
|
|
|
+ inUpdate=''; [ "$Relese" == "Ubuntu" ] && inUpdate='-updates'
|
|
|
|
|
+ MirrorTEMP="SUB_MIRROR/dists/${DIST}${inUpdate}/main/installer-${VER}/current/images/netboot/${relese}-installer/${VER}/initrd.gz"
|
|
|
|
|
+ elif [ "$Relese" == "CentOS" ]; then
|
|
|
|
|
+ MirrorTEMP="SUB_MIRROR/${DIST}/os/${VER}/isolinux/initrd.img"
|
|
|
|
|
+ fi
|
|
|
|
|
+ [ -n "$MirrorTEMP" ] || exit 1
|
|
|
|
|
+ MirrorStatus=0
|
|
|
|
|
+ declare -A MirrorBackup
|
|
|
|
|
+ MirrorBackup=(["Debian0"]="" ["Debian1"]="http://deb.debian.org/debian" ["Debian2"]="http://archive.debian.org/debian" ["Ubuntu0"]="" ["Ubuntu1"]="http://archive.ubuntu.com/ubuntu" ["CentOS0"]="" ["CentOS1"]="http://mirror.centos.org/centos" ["CentOS2"]="http://vault.centos.org")
|
|
|
|
|
+ echo "$New" |grep -q '^http://\|^https://\|^ftp://' && MirrorBackup[${Relese}0]="$New"
|
|
|
|
|
+ for mirror in $(echo "${!MirrorBackup[@]}" |sed 's/\ /\n/g' |sort -n |grep "^$Relese")
|
|
|
|
|
+ do
|
|
|
|
|
+ CurMirror="${MirrorBackup[$mirror]}"
|
|
|
|
|
+ [ -n "$CurMirror" ] || continue
|
|
|
|
|
+ MirrorURL=`echo "$MirrorTEMP" |sed "s#SUB_MIRROR#${CurMirror}#g"`
|
|
|
|
|
+ wget --no-check-certificate --spider --timeout=3 -o /dev/null "$MirrorURL"
|
|
|
|
|
+ [ $? -eq 0 ] && MirrorStatus=1 && break
|
|
|
|
|
+ done
|
|
|
|
|
+ [ $MirrorStatus -eq 1 ] && echo "$CurMirror" || exit 1
|
|
|
|
|
+}
|
|
|
|
|
|
|
|
|
|
+[ -n "$Relese" ] || Relese='Debian'
|
|
|
|
|
+linux_relese=$(echo "$Relese" |sed 's/\ //g' |sed -r 's/(.*)/\L\1/')
|
|
|
clear && echo -e "\n\033[36m# Check Dependence\033[0m\n"
|
|
clear && echo -e "\n\033[36m# Check Dependence\033[0m\n"
|
|
|
|
|
|
|
|
if [[ "$ddMode" == '1' ]]; then
|
|
if [[ "$ddMode" == '1' ]]; then
|
|
|
CheckDependence iconv;
|
|
CheckDependence iconv;
|
|
|
- linuxdists='debian';
|
|
|
|
|
- tmpDIST='jessie';
|
|
|
|
|
|
|
+ linux_relese='ubuntu';
|
|
|
|
|
+ tmpDIST='bionic';
|
|
|
tmpVER='amd64';
|
|
tmpVER='amd64';
|
|
|
tmpINS='auto';
|
|
tmpINS='auto';
|
|
|
fi
|
|
fi
|
|
|
|
|
|
|
|
-if [[ "$linuxdists" == 'debian' ]] || [[ "$linuxdists" == 'ubuntu' ]]; then
|
|
|
|
|
|
|
+if [[ "$Relese" == 'Debian' ]] || [[ "$Relese" == 'Ubuntu' ]]; then
|
|
|
CheckDependence wget,awk,grep,sed,cut,cat,cpio,gzip,find,dirname,basename;
|
|
CheckDependence wget,awk,grep,sed,cut,cat,cpio,gzip,find,dirname,basename;
|
|
|
-elif [[ "$linuxdists" == 'centos' ]]; then
|
|
|
|
|
|
|
+elif [[ "$Relese" == 'CentOS' ]]; then
|
|
|
CheckDependence wget,awk,grep,sed,cut,cat,cpio,gzip,find,dirname,basename,file,xz;
|
|
CheckDependence wget,awk,grep,sed,cut,cat,cpio,gzip,find,dirname,basename,file,xz;
|
|
|
fi
|
|
fi
|
|
|
-
|
|
|
|
|
-if [[ -n "$tmpWORD" ]]; then
|
|
|
|
|
- CheckDependence openssl;
|
|
|
|
|
-fi
|
|
|
|
|
|
|
+[ -n "$tmpWORD" ] && CheckDependence openssl
|
|
|
|
|
|
|
|
if [[ "$loaderMode" == "0" ]]; then
|
|
if [[ "$loaderMode" == "0" ]]; then
|
|
|
- [[ -f '/boot/grub/grub.cfg' ]] && GRUBOLD='0' && GRUBDIR='/boot/grub' && GRUBFILE='grub.cfg';
|
|
|
|
|
- [[ -z "$GRUBDIR" ]] && [[ -f '/boot/grub2/grub.cfg' ]] && GRUBOLD='0' && GRUBDIR='/boot/grub2' && GRUBFILE='grub.cfg';
|
|
|
|
|
- [[ -z "$GRUBDIR" ]] && [[ -f '/boot/grub/grub.conf' ]] && GRUBOLD='1' && GRUBDIR='/boot/grub' && GRUBFILE='grub.conf';
|
|
|
|
|
- [ -z "$GRUBDIR" -o -z "$GRUBFILE" ] && echo -ne "Error! \nNot Found grub path.\n" && exit 1;
|
|
|
|
|
|
|
+ [[ -f '/boot/grub/grub.cfg' ]] && GRUBVER='0' && GRUBDIR='/boot/grub' && GRUBFILE='grub.cfg';
|
|
|
|
|
+ [[ -z "$GRUBDIR" ]] && [[ -f '/boot/grub2/grub.cfg' ]] && GRUBVER='0' && GRUBDIR='/boot/grub2' && GRUBFILE='grub.cfg';
|
|
|
|
|
+ [[ -z "$GRUBDIR" ]] && [[ -f '/boot/grub/grub.conf' ]] && GRUBVER='1' && GRUBDIR='/boot/grub' && GRUBFILE='grub.conf';
|
|
|
|
|
+ [ -z "$GRUBDIR" -o -z "$GRUBFILE" ] && echo -ne "Error! \nNot Found grub.\n" && exit 1;
|
|
|
else
|
|
else
|
|
|
tmpINS='auto'
|
|
tmpINS='auto'
|
|
|
- ddMode='0'
|
|
|
|
|
-fi
|
|
|
|
|
-
|
|
|
|
|
-if [[ "$isMirror" == '1' ]]; then
|
|
|
|
|
- if [[ -n "$tmpMirror" ]]; then
|
|
|
|
|
- TMPMirrorHost="$(echo -n "$tmpMirror" |grep -Eo '.*\.(\w+)')";
|
|
|
|
|
- echo "$TMPMirrorHost" |grep -q '://';
|
|
|
|
|
- if [[ $? == '0' ]]; then
|
|
|
|
|
- MirrorHost="$(echo "$TMPMirrorHost" |awk -F'://' '{print $2}')";
|
|
|
|
|
- else
|
|
|
|
|
- echo -en "\n\033[31mInvaild Mirror! \033[0m\n";
|
|
|
|
|
- [[ "$linuxdists" == 'debian' ]] && echo -en "\033[33mexample:\033[0m http://deb.debian.org/debian\n\n";
|
|
|
|
|
- [[ "$linuxdists" == 'ubuntu' ]] && echo -en "\033[33mexample:\033[0m http://archive.ubuntu.com/ubuntu\n\n";
|
|
|
|
|
- [[ "$linuxdists" == 'centos' ]] && echo -en "\033[33mexample:\033[0m http://mirror.centos.org/centos\n\n";
|
|
|
|
|
- exit 1
|
|
|
|
|
- fi
|
|
|
|
|
- if [[ -n "$MirrorHost" ]]; then
|
|
|
|
|
- MirrorFolder="$(echo -n "$tmpMirror" |awk -F''${MirrorHost}'' '{print $2}' |sed 's/\/$//g')";
|
|
|
|
|
- if [[ -z "$MirrorFolder" ]]; then
|
|
|
|
|
- [[ "$linuxdists" == 'debian' ]] && MirrorFolder='/debian';
|
|
|
|
|
- [[ "$linuxdists" == 'ubuntu' ]] && MirrorFolder='/ubuntu';
|
|
|
|
|
- [[ "$linuxdists" == 'centos' ]] && MirrorFolder='/centos';
|
|
|
|
|
- fi
|
|
|
|
|
- DISTMirror="${MirrorHost}${MirrorFolder}";
|
|
|
|
|
- fi
|
|
|
|
|
- fi
|
|
|
|
|
-fi
|
|
|
|
|
-
|
|
|
|
|
-if [[ -z "$DISTMirror" ]]; then
|
|
|
|
|
- [[ "$linuxdists" == 'debian' ]] && MirrorHost='deb.debian.org' && MirrorFolder='/debian' && DISTMirror="${MirrorHost}${MirrorFolder}";
|
|
|
|
|
- [[ "$linuxdists" == 'ubuntu' ]] && MirrorHost='archive.ubuntu.com' && MirrorFolder='/ubuntu' && DISTMirror="${MirrorHost}${MirrorFolder}";
|
|
|
|
|
- [[ "$linuxdists" == 'centos' ]] && DISTMirror='vault.centos.org';
|
|
|
|
|
fi
|
|
fi
|
|
|
|
|
|
|
|
if [[ -n "$tmpVER" ]]; then
|
|
if [[ -n "$tmpVER" ]]; then
|
|
@@ -242,34 +243,23 @@ if [[ -n "$tmpVER" ]]; then
|
|
|
VER='i386';
|
|
VER='i386';
|
|
|
fi
|
|
fi
|
|
|
if [[ "$tmpVER" == '64' ]] || [[ "$tmpVER" == 'amd64' ]] || [[ "$tmpVER" == 'x86_64' ]] || [[ "$tmpVER" == 'x64' ]]; then
|
|
if [[ "$tmpVER" == '64' ]] || [[ "$tmpVER" == 'amd64' ]] || [[ "$tmpVER" == 'x86_64' ]] || [[ "$tmpVER" == 'x64' ]]; then
|
|
|
- if [[ "$linuxdists" == 'debian' ]] || [[ "$linuxdists" == 'ubuntu' ]]; then
|
|
|
|
|
|
|
+ if [[ "$Relese" == 'Debian' ]] || [[ "$Relese" == 'Ubuntu' ]]; then
|
|
|
VER='amd64';
|
|
VER='amd64';
|
|
|
- elif [[ "$linuxdists" == 'centos' ]]; then
|
|
|
|
|
|
|
+ elif [[ "$Relese" == 'CentOS' ]]; then
|
|
|
VER='x86_64';
|
|
VER='x86_64';
|
|
|
fi
|
|
fi
|
|
|
fi
|
|
fi
|
|
|
fi
|
|
fi
|
|
|
-
|
|
|
|
|
-if [[ -z "$VER" ]]; then
|
|
|
|
|
- VER='i386';
|
|
|
|
|
-fi
|
|
|
|
|
-
|
|
|
|
|
-if [[ -n "$tmpPrefer" ]]; then
|
|
|
|
|
- PreferOption="$(echo "$tmpPrefer" |sed 's/[[:space:]]*//g')"
|
|
|
|
|
-fi
|
|
|
|
|
-
|
|
|
|
|
-if [[ -z "$PreferOption" ]]; then
|
|
|
|
|
- PreferOption='current';
|
|
|
|
|
-fi
|
|
|
|
|
|
|
+[ -z "$VER" ] && VER='amd64'
|
|
|
|
|
|
|
|
if [[ -z "$tmpDIST" ]]; then
|
|
if [[ -z "$tmpDIST" ]]; then
|
|
|
- [[ "$linuxdists" == 'debian' ]] && DIST='jessie';
|
|
|
|
|
- [[ "$linuxdists" == 'ubuntu' ]] && DIST='xenial';
|
|
|
|
|
- [[ "$linuxdists" == 'centos' ]] && DIST='6.8';
|
|
|
|
|
|
|
+ [ "$Relese" == 'Debian' ] && tmpDIST='stretch' && DIST='stretch';
|
|
|
|
|
+ [ "$Relese" == 'Ubuntu' ] && tmpDIST='bionic' && DIST='bionic';
|
|
|
|
|
+ [ "$Relese" == 'CentOS' ] && tmpDIST='6.10' && DIST='6.10';
|
|
|
fi
|
|
fi
|
|
|
|
|
|
|
|
if [[ -z "$DIST" ]]; then
|
|
if [[ -z "$DIST" ]]; then
|
|
|
- if [[ "$linuxdists" == 'debian' ]]; then
|
|
|
|
|
|
|
+ if [[ "$Relese" == 'Debian' ]]; then
|
|
|
SpikCheckDIST='0'
|
|
SpikCheckDIST='0'
|
|
|
DIST="$(echo "$tmpDIST" |sed -r 's/(.*)/\L\1/')";
|
|
DIST="$(echo "$tmpDIST" |sed -r 's/(.*)/\L\1/')";
|
|
|
echo "$DIST" |grep -q '[0-9]';
|
|
echo "$DIST" |grep -q '[0-9]';
|
|
@@ -282,8 +272,9 @@ if [[ -z "$DIST" ]]; then
|
|
|
[[ "$isDigital" == '10' ]] && DIST='buster';
|
|
[[ "$isDigital" == '10' ]] && DIST='buster';
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ LinuxMirror=$(SelectMirror "$Relese" "$DIST" "$VER" "$tmpMirror")
|
|
|
fi
|
|
fi
|
|
|
- if [[ "$linuxdists" == 'ubuntu' ]]; then
|
|
|
|
|
|
|
+ if [[ "$Relese" == 'Ubuntu' ]]; then
|
|
|
SpikCheckDIST='0'
|
|
SpikCheckDIST='0'
|
|
|
DIST="$(echo "$tmpDIST" |sed -r 's/(.*)/\L\1/')";
|
|
DIST="$(echo "$tmpDIST" |sed -r 's/(.*)/\L\1/')";
|
|
|
echo "$DIST" |grep -q '[0-9]';
|
|
echo "$DIST" |grep -q '[0-9]';
|
|
@@ -296,37 +287,41 @@ if [[ -z "$DIST" ]]; then
|
|
|
[[ "$isDigital" == '18.04' ]] && DIST='bionic';
|
|
[[ "$isDigital" == '18.04' ]] && DIST='bionic';
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ LinuxMirror=$(SelectMirror "$Relese" "$DIST" "$VER" "$tmpMirror")
|
|
|
fi
|
|
fi
|
|
|
- if [[ "$linuxdists" == 'centos' ]]; then
|
|
|
|
|
|
|
+ if [[ "$Relese" == 'CentOS' ]]; then
|
|
|
SpikCheckDIST='1'
|
|
SpikCheckDIST='1'
|
|
|
DISTCheck="$(echo "$tmpDIST" |grep -o '[\.0-9]\{1,\}')";
|
|
DISTCheck="$(echo "$tmpDIST" |grep -o '[\.0-9]\{1,\}')";
|
|
|
- ListDIST="$(wget --no-check-certificate -qO- "http://$DISTMirror/dir_sizes" |cut -f2 |grep '^[0-9]')"
|
|
|
|
|
|
|
+ LinuxMirror=$(SelectMirror "$Relese" "$DISTCheck" "$VER" "$tmpMirror")
|
|
|
|
|
+ ListDIST="$(wget --no-check-certificate -qO- "$LinuxMirror/dir_sizes" |cut -f2 |grep '^[0-9]')"
|
|
|
DIST="$(echo "$ListDIST" |grep "^$DISTCheck" |head -n1)"
|
|
DIST="$(echo "$ListDIST" |grep "^$DISTCheck" |head -n1)"
|
|
|
[[ -z "$DIST" ]] && {
|
|
[[ -z "$DIST" ]] && {
|
|
|
echo -ne '\nThe dists version not found in this mirror, Please check it! \n\n'
|
|
echo -ne '\nThe dists version not found in this mirror, Please check it! \n\n'
|
|
|
bash $0 error;
|
|
bash $0 error;
|
|
|
exit 1;
|
|
exit 1;
|
|
|
}
|
|
}
|
|
|
- wget --no-check-certificate -qO- "http://$DISTMirror/$DIST/os/$VER/.treeinfo" |grep -q 'general';
|
|
|
|
|
|
|
+ wget --no-check-certificate -qO- "$LinuxMirror/$DIST/os/$VER/.treeinfo" |grep -q 'general';
|
|
|
[[ $? != '0' ]] && {
|
|
[[ $? != '0' ]] && {
|
|
|
- wget --no-check-certificate -qO- "http://$DISTMirror/centos/$DIST/os/$VER/.treeinfo" |grep -q 'general';
|
|
|
|
|
- [[ $? == '0' ]] && {
|
|
|
|
|
- DISTMirror="${DISTMirror}/${linuxdists}"
|
|
|
|
|
- } || {
|
|
|
|
|
echo -ne "\nThe version not found in this mirror, Please change mirror try again! \n\n";
|
|
echo -ne "\nThe version not found in this mirror, Please change mirror try again! \n\n";
|
|
|
exit 1;
|
|
exit 1;
|
|
|
- }
|
|
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
fi
|
|
fi
|
|
|
fi
|
|
fi
|
|
|
|
|
|
|
|
|
|
+if [[ -z "$LinuxMirror" ]]; then
|
|
|
|
|
+ echo -ne "\033[31mError! \033[0mInvaild mirror! \n"
|
|
|
|
|
+ [ "$Relese" == 'Debian' ] && echo -en "\033[33mexample:\033[0m http://deb.debian.org/debian\n\n";
|
|
|
|
|
+ [ "$Relese" == 'Ubuntu' ] && echo -en "\033[33mexample:\033[0m http://archive.ubuntu.com/ubuntu\n\n";
|
|
|
|
|
+ [ "$Relese" == 'CentOS' ] && echo -en "\033[33mexample:\033[0m http://mirror.centos.org/centos\n\n";
|
|
|
|
|
+ bash $0 error;
|
|
|
|
|
+ exit 1;
|
|
|
|
|
+fi
|
|
|
|
|
+
|
|
|
if [[ "$SpikCheckDIST" == '0' ]]; then
|
|
if [[ "$SpikCheckDIST" == '0' ]]; then
|
|
|
- DistsList="$(wget --no-check-certificate -qO- "http://$DISTMirror/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')";
|
|
|
|
|
|
|
+ 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')";
|
|
|
for CheckDEB in `echo "$DistsList" |sed 's/;/\n/g'`
|
|
for CheckDEB in `echo "$DistsList" |sed 's/;/\n/g'`
|
|
|
do
|
|
do
|
|
|
- [[ "$CheckDEB" == "$DIST" ]] && FindDists='1';
|
|
|
|
|
- [[ "$FindDists" == '1' ]] && break;
|
|
|
|
|
|
|
+ [[ "$CheckDEB" == "$DIST" ]] && FindDists='1' && break;
|
|
|
done
|
|
done
|
|
|
[[ "$FindDists" == '0' ]] && {
|
|
[[ "$FindDists" == '0' ]] && {
|
|
|
echo -ne '\nThe dists version not found, Please check it! \n\n'
|
|
echo -ne '\nThe dists version not found, Please check it! \n\n'
|
|
@@ -336,7 +331,7 @@ if [[ "$SpikCheckDIST" == '0' ]]; then
|
|
|
fi
|
|
fi
|
|
|
|
|
|
|
|
[[ "$ddMode" == '1' ]] && {
|
|
[[ "$ddMode" == '1' ]] && {
|
|
|
- export SSL_SUPPORT='https://tech.cxthhhhh.com/tech-tools/Network-Reinstall-System-Modify/wget_udeb_amd64.tar.gz';
|
|
|
|
|
|
|
+ export SSL_SUPPORT='https://cxthhhhh.com/tech-tools/Network-Reinstall-System-Modify/wget_udeb_amd64.tar.gz';
|
|
|
if [[ -n "$tmpURL" ]]; then
|
|
if [[ -n "$tmpURL" ]]; then
|
|
|
DDURL="$tmpURL"
|
|
DDURL="$tmpURL"
|
|
|
echo "$DDURL" |grep -q '^http://\|^ftp://\|^https://';
|
|
echo "$DDURL" |grep -q '^http://\|^ftp://\|^https://';
|
|
@@ -356,13 +351,11 @@ fi
|
|
|
[ -n "$ipAddr" ] && [ -n "$ipMask" ] && [ -n "$ipGate" ] && setNet='1';
|
|
[ -n "$ipAddr" ] && [ -n "$ipMask" ] && [ -n "$ipGate" ] && setNet='1';
|
|
|
[[ -n "$tmpWORD" ]] && myPASSWORD="$(openssl passwd -1 "$tmpWORD")";
|
|
[[ -n "$tmpWORD" ]] && myPASSWORD="$(openssl passwd -1 "$tmpWORD")";
|
|
|
[[ -z "$myPASSWORD" ]] && myPASSWORD='$1$UIl1uSg0$tAW9qjOqoCto0CIUgUwHT1';
|
|
[[ -z "$myPASSWORD" ]] && myPASSWORD='$1$UIl1uSg0$tAW9qjOqoCto0CIUgUwHT1';
|
|
|
-[[ -n "$tmpFW" ]] && INCFW="$tmpFW";
|
|
|
|
|
-[[ -z "$INCFW" ]] && INCFW='0';
|
|
|
|
|
|
|
|
|
|
if [[ -n "$interface" ]]; then
|
|
if [[ -n "$interface" ]]; then
|
|
|
IFETH="$interface"
|
|
IFETH="$interface"
|
|
|
else
|
|
else
|
|
|
- if [[ "$linuxdists" == 'centos' ]]; then
|
|
|
|
|
|
|
+ if [[ "$linux_relese" == 'centos' ]]; then
|
|
|
IFETH="link"
|
|
IFETH="link"
|
|
|
else
|
|
else
|
|
|
IFETH="auto"
|
|
IFETH="auto"
|
|
@@ -374,7 +367,7 @@ clear && echo -e "\n\033[36m# Install\033[0m\n"
|
|
|
ASKVNC(){
|
|
ASKVNC(){
|
|
|
inVNC='y';
|
|
inVNC='y';
|
|
|
[[ "$ddMode" == '0' ]] && {
|
|
[[ "$ddMode" == '0' ]] && {
|
|
|
- echo -ne "\033[34mCan you login VNC?\033[0m\e[33m[\e[32my\e[33m/n]\e[0m "
|
|
|
|
|
|
|
+ echo -ne "\033[34mDo you want to install os manually?\033[0m\e[33m[\e[32my\e[33m/n]\e[0m "
|
|
|
read tmpinVNC
|
|
read tmpinVNC
|
|
|
[[ -n "$inVNCtmp" ]] && inVNC="$tmpinVNC"
|
|
[[ -n "$inVNCtmp" ]] && inVNC="$tmpinVNC"
|
|
|
}
|
|
}
|
|
@@ -383,18 +376,15 @@ ASKVNC(){
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
[ "$inVNC" == 'y' -o "$inVNC" == 'n' ] || ASKVNC;
|
|
[ "$inVNC" == 'y' -o "$inVNC" == 'n' ] || ASKVNC;
|
|
|
-[[ "$linuxdists" == 'debian' ]] && LinuxName='Debian';
|
|
|
|
|
-[[ "$linuxdists" == 'ubuntu' ]] && LinuxName='Ubuntu';
|
|
|
|
|
-[[ "$linuxdists" == 'centos' ]] && LinuxName='CentOS';
|
|
|
|
|
[[ "$ddMode" == '0' ]] && {
|
|
[[ "$ddMode" == '0' ]] && {
|
|
|
- [[ "$inVNC" == 'y' ]] && echo -e "\033[34mManual Mode\033[0m insatll \033[33m$LinuxName\033[0m [\033[33m$DIST\033[0m] [\033[33m$VER\033[0m] in VNC. "
|
|
|
|
|
- [[ "$inVNC" == 'n' ]] && echo -e "\033[34mAuto Mode\033[0m insatll \033[33m$LinuxName\033[0m [\033[33m$DIST\033[0m] [\033[33m$VER\033[0m]. "
|
|
|
|
|
|
|
+ [[ "$inVNC" == 'y' ]] && echo -e "\033[34mManual Mode\033[0m insatll [\033[33m$Relese\033[0m] [\033[33m$DIST\033[0m] [\033[33m$VER\033[0m] in VNC. "
|
|
|
|
|
+ [[ "$inVNC" == 'n' ]] && echo -e "\033[34mAuto Mode\033[0m insatll [\033[33m$Relese\033[0m] [\033[33m$DIST\033[0m] [\033[33m$VER\033[0m]. "
|
|
|
}
|
|
}
|
|
|
[[ "$ddMode" == '1' ]] && {
|
|
[[ "$ddMode" == '1' ]] && {
|
|
|
echo -ne "\033[34mAuto Mode\033[0m insatll \033[33mWindows\033[0m\n[\033[33m$DDURL\033[0m]\n"
|
|
echo -ne "\033[34mAuto Mode\033[0m insatll \033[33mWindows\033[0m\n[\033[33m$DDURL\033[0m]\n"
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-if [[ "$linuxdists" == 'centos' ]]; then
|
|
|
|
|
|
|
+if [[ "$linux_relese" == 'centos' ]]; then
|
|
|
if [[ "$DIST" != "$UNVER" ]]; then
|
|
if [[ "$DIST" != "$UNVER" ]]; then
|
|
|
awk 'BEGIN{print '${UNVER}'-'${DIST}'}' |grep -q '^-'
|
|
awk 'BEGIN{print '${UNVER}'-'${DIST}'}' |grep -q '^-'
|
|
|
if [ $? != '0' ]; then
|
|
if [ $? != '0' ]; then
|
|
@@ -408,35 +398,37 @@ if [[ "$linuxdists" == 'centos' ]]; then
|
|
|
fi
|
|
fi
|
|
|
awk 'BEGIN{print '${UNVER}'-'${DIST}'+0.59}' |grep -q '^-'
|
|
awk 'BEGIN{print '${UNVER}'-'${DIST}'+0.59}' |grep -q '^-'
|
|
|
if [ $? == '0' ]; then
|
|
if [ $? == '0' ]; then
|
|
|
- echo -en "\n\033[31mThe version higher then \033[33m6.9 \033[31mis not support in current! \033[0m\n\n"
|
|
|
|
|
|
|
+ echo -en "\n\033[31mThe version higher then \033[33m6.10 \033[31mis not support in current! \033[0m\n\n"
|
|
|
exit 1;
|
|
exit 1;
|
|
|
fi
|
|
fi
|
|
|
fi
|
|
fi
|
|
|
fi
|
|
fi
|
|
|
|
|
|
|
|
-echo -e "\n[\033[33m$LinuxName\033[0m] [\033[33m$DIST\033[0m] [\033[33m$VER\033[0m] Downloading..."
|
|
|
|
|
-
|
|
|
|
|
-[[ -z "$DISTMirror" ]] && echo -ne "\033[31mError! \033[0mInvaild mirror! \n" && exit 1
|
|
|
|
|
-
|
|
|
|
|
-if [[ "$linuxdists" == 'debian' ]] || [[ "$linuxdists" == 'ubuntu' ]]; then
|
|
|
|
|
-wget --no-check-certificate -qO '/boot/initrd.img' "http://$DISTMirror/dists/$DIST/main/installer-$VER/$PreferOption/images/netboot/$linuxdists-installer/$VER/initrd.gz"
|
|
|
|
|
-[[ $? -ne '0' ]] && echo -ne "\033[31mError! \033[0mDownload 'initrd.img' for \033[33m$linuxdists\033[0m failed! \n" && exit 1
|
|
|
|
|
-wget --no-check-certificate -qO '/boot/vmlinuz' "http://$DISTMirror/dists/$DIST/main/installer-$VER/$PreferOption/images/netboot/$linuxdists-installer/$VER/linux"
|
|
|
|
|
-[[ $? -ne '0' ]] && echo -ne "\033[31mError! \033[0mDownload 'vmlinuz' for \033[33m$linuxdists\033[0m failed! \n" && exit 1
|
|
|
|
|
-elif [[ "$linuxdists" == 'centos' ]]; then
|
|
|
|
|
-wget --no-check-certificate -qO '/boot/initrd.img' "http://$DISTMirror/$DIST/os/$VER/isolinux/initrd.img"
|
|
|
|
|
-[[ $? -ne '0' ]] && echo -ne "\033[31mError! \033[0mDownload 'initrd.img' for \033[33m$linuxdists\033[0m failed! \n" && exit 1
|
|
|
|
|
-wget --no-check-certificate -qO '/boot/vmlinuz' "http://$DISTMirror/$DIST/os/$VER/isolinux/vmlinuz"
|
|
|
|
|
-[[ $? -ne '0' ]] && echo -ne "\033[31mError! \033[0mDownload 'vmlinuz' for \033[33m$linuxdists\033[0m failed! \n" && exit 1
|
|
|
|
|
|
|
+echo -e "\n[\033[33m$Relese\033[0m] [\033[33m$DIST\033[0m] [\033[33m$VER\033[0m] Downloading..."
|
|
|
|
|
+
|
|
|
|
|
+if [[ "$linux_relese" == 'debian' ]] || [[ "$linux_relese" == 'ubuntu' ]]; then
|
|
|
|
|
+ inUpdate=''; [ "$linux_relese" == 'ubuntu' ] && inUpdate='-updates'
|
|
|
|
|
+ wget --no-check-certificate -qO '/boot/initrd.img' "${LinuxMirror}/dists/${DIST}${inUpdate}/main/installer-${VER}/current/images/netboot/${linux_relese}-installer/${VER}/initrd.gz"
|
|
|
|
|
+ [[ $? -ne '0' ]] && echo -ne "\033[31mError! \033[0mDownload 'initrd.img' for \033[33m$linux_relese\033[0m failed! \n" && exit 1
|
|
|
|
|
+ wget --no-check-certificate -qO '/boot/vmlinuz' "${LinuxMirror}/dists/${DIST}${inUpdate}/main/installer-${VER}/current/images/netboot/${linux_relese}-installer/${VER}/linux"
|
|
|
|
|
+ [[ $? -ne '0' ]] && echo -ne "\033[31mError! \033[0mDownload 'vmlinuz' for \033[33m$linux_relese\033[0m failed! \n" && exit 1
|
|
|
|
|
+ MirrorHost="$(echo "$LinuxMirror" |awk -F'://|/' '{print $2}')";
|
|
|
|
|
+ MirrorFolder="$(echo "$LinuxMirror" |awk -F''${MirrorHost}'' '{print $2}')";
|
|
|
|
|
+elif [[ "$linux_relese" == 'centos' ]]; then
|
|
|
|
|
+ wget --no-check-certificate -qO '/boot/initrd.img' "${LinuxMirror}/${DIST}/os/${VER}/isolinux/initrd.img"
|
|
|
|
|
+ [[ $? -ne '0' ]] && echo -ne "\033[31mError! \033[0mDownload 'initrd.img' for \033[33m$linux_relese\033[0m failed! \n" && exit 1
|
|
|
|
|
+ wget --no-check-certificate -qO '/boot/vmlinuz' "${LinuxMirror}/${DIST}/os/${VER}/isolinux/vmlinuz"
|
|
|
|
|
+ [[ $? -ne '0' ]] && echo -ne "\033[31mError! \033[0mDownload 'vmlinuz' for \033[33m$linux_relese\033[0m failed! \n" && exit 1
|
|
|
|
|
+else
|
|
|
|
|
+ bash $0 error;
|
|
|
|
|
+ exit 1;
|
|
|
fi
|
|
fi
|
|
|
-if [[ "$linuxdists" == 'debian' ]]; then
|
|
|
|
|
- if [[ "$INCFW" == '1' ]]; then
|
|
|
|
|
- wget --no-check-certificate -qO '/boot/firmware.cpio.gz' "http://cdimage.debian.org/cdimage/unofficial/non-free/firmware/$DIST/current/firmware.cpio.gz"
|
|
|
|
|
- [[ $? -ne '0' ]] && echo -ne "\033[31mError! \033[0mDownload 'firmware' for \033[33m$linuxdists\033[0m failed! \n" && exit 1
|
|
|
|
|
- fi
|
|
|
|
|
|
|
+if [[ "$linux_relese" == 'debian' ]]; then
|
|
|
|
|
+ wget --no-check-certificate -qO '/boot/firmware.cpio.gz' "http://cdimage.debian.org/cdimage/unofficial/non-free/firmware/${DIST}/current/firmware.cpio.gz"
|
|
|
|
|
+ [[ $? -ne '0' ]] && echo -ne "\033[31mError! \033[0mDownload 'firmware' for \033[33m$linux_relese\033[0m failed! \n" && exit 1
|
|
|
if [[ "$ddMode" == '1' ]]; then
|
|
if [[ "$ddMode" == '1' ]]; then
|
|
|
- vKernel_udeb=$(wget --no-check-certificate -qO- "http://$DISTMirror/dists/$DIST/main/installer-$VER/$PreferOption/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)
|
|
|
|
|
- [[ -z "vKernel_udeb" ]] && vKernel_udeb="3.16.0-4"
|
|
|
|
|
|
|
+ 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)
|
|
|
|
|
+ [[ -z "vKernel_udeb" ]] && vKernel_udeb="3.16.0-6"
|
|
|
fi
|
|
fi
|
|
|
fi
|
|
fi
|
|
|
|
|
|
|
@@ -518,10 +510,10 @@ if [[ "$loaderMode" == "0" ]]; then
|
|
|
mv -f $GRUBDIR/$GRUBFILE $GRUBDIR/$GRUBFILE.bak;
|
|
mv -f $GRUBDIR/$GRUBFILE $GRUBDIR/$GRUBFILE.bak;
|
|
|
[[ -f $GRUBDIR/$GRUBFILE.old ]] && cat $GRUBDIR/$GRUBFILE.old >$GRUBDIR/$GRUBFILE || cat $GRUBDIR/$GRUBFILE.bak >$GRUBDIR/$GRUBFILE;
|
|
[[ -f $GRUBDIR/$GRUBFILE.old ]] && cat $GRUBDIR/$GRUBFILE.old >$GRUBDIR/$GRUBFILE || cat $GRUBDIR/$GRUBFILE.bak >$GRUBDIR/$GRUBFILE;
|
|
|
else
|
|
else
|
|
|
- GRUBOLD='2'
|
|
|
|
|
|
|
+ GRUBVER='2'
|
|
|
fi
|
|
fi
|
|
|
|
|
|
|
|
-[[ "$GRUBOLD" == '0' ]] && {
|
|
|
|
|
|
|
+[[ "$GRUBVER" == '0' ]] && {
|
|
|
READGRUB='/tmp/grub.read'
|
|
READGRUB='/tmp/grub.read'
|
|
|
cat $GRUBDIR/$GRUBFILE |sed -n '1h;1!H;$g;s/\n/%%%%%%%/g;$p' |grep -om 1 'menuentry\ [^{]*{[^}]*}%%%%%%%' |sed 's/%%%%%%%/\n/g' >$READGRUB
|
|
cat $GRUBDIR/$GRUBFILE |sed -n '1h;1!H;$g;s/\n/%%%%%%%/g;$p' |grep -om 1 'menuentry\ [^{]*{[^}]*}%%%%%%%' |sed 's/%%%%%%%/\n/g' >$READGRUB
|
|
|
LoadNum="$(cat $READGRUB |grep -c 'menuentry ')"
|
|
LoadNum="$(cat $READGRUB |grep -c 'menuentry ')"
|
|
@@ -552,7 +544,7 @@ fi
|
|
|
INSERTGRUB="$(awk '/menuentry /{print NR}' $GRUBDIR/$GRUBFILE|head -n 1)"
|
|
INSERTGRUB="$(awk '/menuentry /{print NR}' $GRUBDIR/$GRUBFILE|head -n 1)"
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-[[ "$GRUBOLD" == '1' ]] && {
|
|
|
|
|
|
|
+[[ "$GRUBVER" == '1' ]] && {
|
|
|
CFG0="$(awk '/title[\ ]|title[\t]/{print NR}' $GRUBDIR/$GRUBFILE|head -n 1)";
|
|
CFG0="$(awk '/title[\ ]|title[\t]/{print NR}' $GRUBDIR/$GRUBFILE|head -n 1)";
|
|
|
CFG1="$(awk '/title[\ ]|title[\t]/{print NR}' $GRUBDIR/$GRUBFILE|head -n 2 |tail -n 1)";
|
|
CFG1="$(awk '/title[\ ]|title[\t]/{print NR}' $GRUBDIR/$GRUBFILE|head -n 2 |tail -n 1)";
|
|
|
[[ -n $CFG0 ]] && [ -z $CFG1 -o $CFG1 == $CFG0 ] && sed -n "$CFG0,$"p $GRUBDIR/$GRUBFILE >/tmp/grub.new;
|
|
[[ -n $CFG0 ]] && [ -z $CFG1 -o $CFG1 == $CFG0 ] && sed -n "$CFG0,$"p $GRUBDIR/$GRUBFILE >/tmp/grub.new;
|
|
@@ -571,10 +563,20 @@ LinuxKernel="$(grep 'linux.*/\|kernel.*/' /tmp/grub.new |awk '{print $1}' |head
|
|
|
LinuxIMG="$(grep 'initrd.*/' /tmp/grub.new |awk '{print $1}' |tail -n 1)";
|
|
LinuxIMG="$(grep 'initrd.*/' /tmp/grub.new |awk '{print $1}' |tail -n 1)";
|
|
|
[ -z "$LinuxIMG" ] && sed -i "/$LinuxKernel.*\//a\\\tinitrd\ \/" /tmp/grub.new && LinuxIMG='initrd';
|
|
[ -z "$LinuxIMG" ] && sed -i "/$LinuxKernel.*\//a\\\tinitrd\ \/" /tmp/grub.new && LinuxIMG='initrd';
|
|
|
|
|
|
|
|
-if [[ "$linuxdists" == 'debian' ]] || [[ "$linuxdists" == 'ubuntu' ]]; then
|
|
|
|
|
- BOOT_OPTION="auto=true hostname=$linuxdists domain= -- quiet"
|
|
|
|
|
-elif [[ "$linuxdists" == 'centos' ]]; then
|
|
|
|
|
- BOOT_OPTION="ks=file://ks.cfg ksdevice=$IFETH"
|
|
|
|
|
|
|
+if [[ "$setInterfaceName" == "1" ]]; then
|
|
|
|
|
+ Add_OPTION="net.ifnames=0 biosdevname=0";
|
|
|
|
|
+else
|
|
|
|
|
+ Add_OPTION="";
|
|
|
|
|
+fi
|
|
|
|
|
+
|
|
|
|
|
+if [[ "$setIPv6" == "1" ]]; then
|
|
|
|
|
+ Add_OPTION="$Add_OPTION ipv6.disable=1";
|
|
|
|
|
+fi
|
|
|
|
|
+
|
|
|
|
|
+if [[ "$linux_relese" == 'debian' ]] || [[ "$linux_relese" == 'ubuntu' ]]; then
|
|
|
|
|
+ BOOT_OPTION="auto=true $Add_OPTION hostname=$linux_relese domain= -- quiet"
|
|
|
|
|
+elif [[ "$linux_relese" == 'centos' ]]; then
|
|
|
|
|
+ BOOT_OPTION="ks=file://ks.cfg $Add_OPTION ksdevice=$IFETH"
|
|
|
fi
|
|
fi
|
|
|
|
|
|
|
|
[[ "$Type" == 'InBoot' ]] && {
|
|
[[ "$Type" == 'InBoot' ]] && {
|
|
@@ -607,9 +609,9 @@ fi
|
|
|
[[ -d /tmp/boot ]] && rm -rf /tmp/boot;
|
|
[[ -d /tmp/boot ]] && rm -rf /tmp/boot;
|
|
|
mkdir -p /tmp/boot;
|
|
mkdir -p /tmp/boot;
|
|
|
cd /tmp/boot;
|
|
cd /tmp/boot;
|
|
|
-if [[ "$linuxdists" == 'debian' ]] || [[ "$linuxdists" == 'ubuntu' ]]; then
|
|
|
|
|
|
|
+if [[ "$linux_relese" == 'debian' ]] || [[ "$linux_relese" == 'ubuntu' ]]; then
|
|
|
COMPTYPE="gzip";
|
|
COMPTYPE="gzip";
|
|
|
-elif [[ "$linuxdists" == 'centos' ]]; then
|
|
|
|
|
|
|
+elif [[ "$linux_relese" == 'centos' ]]; then
|
|
|
COMPTYPE="$(file /boot/initrd.img |grep -o ':.*compressed data' |cut -d' ' -f2 |sed -r 's/(.*)/\L\1/' |head -n1)"
|
|
COMPTYPE="$(file /boot/initrd.img |grep -o ':.*compressed data' |cut -d' ' -f2 |sed -r 's/(.*)/\L\1/' |head -n1)"
|
|
|
[[ -z "$COMPTYPE" ]] && echo "Detect compressed type fail." && exit 1;
|
|
[[ -z "$COMPTYPE" ]] && echo "Detect compressed type fail." && exit 1;
|
|
|
fi
|
|
fi
|
|
@@ -634,7 +636,7 @@ for ListCOMP in `echo -en 'gzip\nlzma\nxz'`
|
|
|
|
|
|
|
|
$UNCOMP < /tmp/$NewIMG | cpio --extract --verbose --make-directories --no-absolute-filenames >>/dev/null 2>&1
|
|
$UNCOMP < /tmp/$NewIMG | cpio --extract --verbose --make-directories --no-absolute-filenames >>/dev/null 2>&1
|
|
|
|
|
|
|
|
-if [[ "$linuxdists" == 'debian' ]] || [[ "$linuxdists" == 'ubuntu' ]]; then
|
|
|
|
|
|
|
+if [[ "$linux_relese" == 'debian' ]] || [[ "$linux_relese" == 'ubuntu' ]]; then
|
|
|
cat >/tmp/boot/preseed.cfg<<EOF
|
|
cat >/tmp/boot/preseed.cfg<<EOF
|
|
|
d-i debian-installer/locale string en_US
|
|
d-i debian-installer/locale string en_US
|
|
|
d-i console-setup/layoutcode string us
|
|
d-i console-setup/layoutcode string us
|
|
@@ -659,6 +661,7 @@ d-i mirror/country string manual
|
|
|
d-i mirror/http/hostname string $MirrorHost
|
|
d-i mirror/http/hostname string $MirrorHost
|
|
|
d-i mirror/http/directory string $MirrorFolder
|
|
d-i mirror/http/directory string $MirrorFolder
|
|
|
d-i mirror/http/proxy string
|
|
d-i mirror/http/proxy string
|
|
|
|
|
+d-i apt-setup/services-select multiselect
|
|
|
|
|
|
|
|
d-i passwd/root-login boolean ture
|
|
d-i passwd/root-login boolean ture
|
|
|
d-i passwd/make-user boolean false
|
|
d-i passwd/make-user boolean false
|
|
@@ -724,6 +727,9 @@ EOF
|
|
|
|
|
|
|
|
[[ "$DIST" == 'trusty' ]] && GRUBPATCH='1'
|
|
[[ "$DIST" == 'trusty' ]] && GRUBPATCH='1'
|
|
|
[[ "$DIST" == 'wily' ]] && GRUBPATCH='1'
|
|
[[ "$DIST" == 'wily' ]] && GRUBPATCH='1'
|
|
|
|
|
+[[ "$DIST" == 'xenial' ]] && {
|
|
|
|
|
+ sed -i 's/^d-i\ clock-setup\/ntp\ boolean\ true/d-i\ clock-setup\/ntp\ boolean\ false/g' /tmp/boot/preseed.cfg
|
|
|
|
|
+}
|
|
|
|
|
|
|
|
[[ "$GRUBPATCH" == '1' ]] && {
|
|
[[ "$GRUBPATCH" == '1' ]] && {
|
|
|
sed -i 's/^d-i\ grub-installer\/bootdev\ string\ default//g' /tmp/boot/preseed.cfg
|
|
sed -i 's/^d-i\ grub-installer\/bootdev\ string\ default//g' /tmp/boot/preseed.cfg
|
|
@@ -731,17 +737,14 @@ EOF
|
|
|
[[ "$GRUBPATCH" == '0' ]] && {
|
|
[[ "$GRUBPATCH" == '0' ]] && {
|
|
|
sed -i 's/debconf-set\ grub-installer\/bootdev.*\"\;//g' /tmp/boot/preseed.cfg
|
|
sed -i 's/debconf-set\ grub-installer\/bootdev.*\"\;//g' /tmp/boot/preseed.cfg
|
|
|
}
|
|
}
|
|
|
-[[ "$DIST" == 'xenial' ]] && {
|
|
|
|
|
- sed -i 's/^d-i\ clock-setup\/ntp\ boolean\ true/d-i\ clock-setup\/ntp\ boolean\ false/g' /tmp/boot/preseed.cfg
|
|
|
|
|
-}
|
|
|
|
|
|
|
|
|
|
-[[ "$linuxdists" == 'debian' ]] && {
|
|
|
|
|
|
|
+[[ "$linux_relese" == 'debian' ]] && {
|
|
|
sed -i '/user-setup\/allow-password-weak/d' /tmp/boot/preseed.cfg
|
|
sed -i '/user-setup\/allow-password-weak/d' /tmp/boot/preseed.cfg
|
|
|
sed -i '/user-setup\/encrypt-home/d' /tmp/boot/preseed.cfg
|
|
sed -i '/user-setup\/encrypt-home/d' /tmp/boot/preseed.cfg
|
|
|
sed -i '/pkgsel\/update-policy/d' /tmp/boot/preseed.cfg
|
|
sed -i '/pkgsel\/update-policy/d' /tmp/boot/preseed.cfg
|
|
|
sed -i 's/umount\ \/media.*true\;\ //g' /tmp/boot/preseed.cfg
|
|
sed -i 's/umount\ \/media.*true\;\ //g' /tmp/boot/preseed.cfg
|
|
|
}
|
|
}
|
|
|
-[[ "$INCFW" == '1' ]] && [[ "$linuxdists" == 'debian' ]] && [[ -f '/boot/firmware.cpio.gz' ]] && {
|
|
|
|
|
|
|
+[[ "$linux_relese" == 'debian' ]] && [[ -f '/boot/firmware.cpio.gz' ]] && {
|
|
|
gzip -d < /boot/firmware.cpio.gz | cpio --extract --verbose --make-directories --no-absolute-filenames >>/dev/null 2>&1
|
|
gzip -d < /boot/firmware.cpio.gz | cpio --extract --verbose --make-directories --no-absolute-filenames >>/dev/null 2>&1
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -780,12 +783,12 @@ WinRDP(){
|
|
|
sed -i 's/wget.*\/sbin\/reboot\;\ //g' /tmp/boot/preseed.cfg
|
|
sed -i 's/wget.*\/sbin\/reboot\;\ //g' /tmp/boot/preseed.cfg
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-elif [[ "$linuxdists" == 'centos' ]]; then
|
|
|
|
|
|
|
+elif [[ "$linux_relese" == 'centos' ]]; then
|
|
|
cat >/tmp/boot/ks.cfg<<EOF
|
|
cat >/tmp/boot/ks.cfg<<EOF
|
|
|
#platform=x86, AMD64, or Intel EM64T
|
|
#platform=x86, AMD64, or Intel EM64T
|
|
|
firewall --enabled --ssh
|
|
firewall --enabled --ssh
|
|
|
install
|
|
install
|
|
|
-url --url="http://$DISTMirror/$DIST/os/$VER/"
|
|
|
|
|
|
|
+url --url="$LinuxMirror/$DIST/os/$VER/"
|
|
|
rootpw --iscrypted $myPASSWORD
|
|
rootpw --iscrypted $myPASSWORD
|
|
|
auth --useshadow --passalgo=sha512
|
|
auth --useshadow --passalgo=sha512
|
|
|
firstboot --disable
|
|
firstboot --disable
|
|
@@ -833,7 +836,7 @@ rm -rf /tmp/boot;
|
|
|
[[ "$inVNC" == 'y' ]] && {
|
|
[[ "$inVNC" == 'y' ]] && {
|
|
|
sed -i '$i\\n' $GRUBDIR/$GRUBFILE
|
|
sed -i '$i\\n' $GRUBDIR/$GRUBFILE
|
|
|
sed -i '$r /tmp/grub.new' $GRUBDIR/$GRUBFILE
|
|
sed -i '$r /tmp/grub.new' $GRUBDIR/$GRUBFILE
|
|
|
- echo -e "\n\033[33m\033[04mIt will reboot! \nPlease look at VNC! \nSelect\033[0m\033[32m Install OS [$DIST $VER] \033[33m\033[4mto install system.\033[04m\n\n\033[31m\033[04mThere is some information for you.\nDO NOT CLOSE THE WINDOW! \033[0m\n"
|
|
|
|
|
|
|
+ echo -e "\n\033[33m\033[04mIt will reboot! \nPlease connect VNC! \nSelect\033[0m\033[32m Install OS [$DIST $VER] \033[33m\033[4mto install system.\033[04m\n\n\033[31m\033[04mThere is some information for you.\nDO NOT CLOSE THE WINDOW! \033[0m\n"
|
|
|
echo -e "\033[35mIPv4\t\tNETMASK\t\tGATEWAY\033[0m"
|
|
echo -e "\033[35mIPv4\t\tNETMASK\t\tGATEWAY\033[0m"
|
|
|
echo -e "\033[36m\033[04m$IPv4\033[0m\t\033[36m\033[04m$MASK\033[0m\t\033[36m\033[04m$GATE\033[0m\n\n"
|
|
echo -e "\033[36m\033[04m$IPv4\033[0m\t\033[36m\033[04m$MASK\033[0m\t\033[36m\033[04m$GATE\033[0m\n\n"
|
|
|
|
|
|
|
@@ -851,5 +854,7 @@ else
|
|
|
mkdir -p "$HOME/loader"
|
|
mkdir -p "$HOME/loader"
|
|
|
cp -rf "/boot/initrd.img" "$HOME/loader/initrd.img"
|
|
cp -rf "/boot/initrd.img" "$HOME/loader/initrd.img"
|
|
|
cp -rf "/boot/vmlinuz" "$HOME/loader/vmlinuz"
|
|
cp -rf "/boot/vmlinuz" "$HOME/loader/vmlinuz"
|
|
|
|
|
+ [[ -f "/boot/initrd.img" ]] && rm -rf "/boot/initrd.img"
|
|
|
|
|
+ [[ -f "/boot/vmlinuz" ]] && rm -rf "/boot/vmlinuz"
|
|
|
echo && ls -AR1 "$HOME/loader"
|
|
echo && ls -AR1 "$HOME/loader"
|
|
|
fi
|
|
fi
|