mirror of
https://github.com/leitbogioro/Tools.git
synced 2025-10-06 05:16:38 +08:00
Update InstallNET.sh
This commit is contained in:
parent
1de9c9aee2
commit
75fd04bae5
1 changed files with 31 additions and 8 deletions
|
@ -8,7 +8,6 @@
|
|||
## Written By MoeClub.org
|
||||
## Modified By Leitbogioro
|
||||
|
||||
|
||||
export tmpVER=''
|
||||
export tmpDIST=''
|
||||
export tmpURL=''
|
||||
|
@ -25,6 +24,7 @@ export ddMode='0'
|
|||
export setNet='0'
|
||||
export setRDP='0'
|
||||
export setIPv6='0'
|
||||
export ssh_port='22'
|
||||
export isMirror='0'
|
||||
export FindDists='0'
|
||||
export loaderMode='0'
|
||||
|
@ -128,6 +128,11 @@ while [[ $# -ge 1 ]]; do
|
|||
tmpSSL="$1"
|
||||
shift
|
||||
;;
|
||||
-ssh)
|
||||
shift
|
||||
ssh_port="$1"
|
||||
shift
|
||||
;;
|
||||
-firmware|--cdimage)
|
||||
shift
|
||||
IncFirmware="1"
|
||||
|
@ -147,6 +152,10 @@ while [[ $# -ge 1 ]]; do
|
|||
esac
|
||||
done
|
||||
|
||||
if [[ ! ${ssh_port} -ge "1" ]] || [[ ! ${ssh_port} -le "65535" ]] || [[ ! ${ssh_port} =~ ^[1-9]+$ ]]; then
|
||||
ssh_port='22'
|
||||
fi
|
||||
|
||||
[[ "$EUID" -ne '0' ]] && echo "Error:This script must be run as root!" && exit 1;
|
||||
|
||||
function CheckDependence(){
|
||||
|
@ -190,7 +199,11 @@ function SelectMirror(){
|
|||
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"
|
||||
if [[ "$isDigital" == '20.04' ]] || [[ "$DIST" == 'focal' ]]; then
|
||||
MirrorTEMP="SUB_MIRROR/dists/${DIST}/main/installer-${VER}/current/legacy-images/netboot/${relese}-installer/${VER}/initrd.gz"
|
||||
else
|
||||
MirrorTEMP="SUB_MIRROR/dists/${DIST}${inUpdate}/main/installer-${VER}/current/images/netboot/${relese}-installer/${VER}/initrd.gz"
|
||||
fi
|
||||
elif [ "$Relese" == "CentOS" ]; then
|
||||
MirrorTEMP="SUB_MIRROR/${DIST}/os/${VER}/isolinux/initrd.img"
|
||||
fi
|
||||
|
@ -271,6 +284,7 @@ if [[ -z "$DIST" ]]; then
|
|||
[[ "$isDigital" == '8' ]] && DIST='jessie';
|
||||
[[ "$isDigital" == '9' ]] && DIST='stretch';
|
||||
[[ "$isDigital" == '10' ]] && DIST='buster';
|
||||
[[ "$isDigital" == '11' ]] && DIST='bullseye';
|
||||
}
|
||||
}
|
||||
LinuxMirror=$(SelectMirror "$Relese" "$DIST" "$VER" "$tmpMirror")
|
||||
|
@ -286,6 +300,7 @@ if [[ -z "$DIST" ]]; then
|
|||
[[ "$isDigital" == '14.04' ]] && DIST='trusty';
|
||||
[[ "$isDigital" == '16.04' ]] && DIST='xenial';
|
||||
[[ "$isDigital" == '18.04' ]] && DIST='bionic';
|
||||
[[ "$isDigital" == '20.04' ]] && DIST='focal';
|
||||
}
|
||||
}
|
||||
LinuxMirror=$(SelectMirror "$Relese" "$DIST" "$VER" "$tmpMirror")
|
||||
|
@ -409,10 +424,17 @@ echo -e "\n[\033[33m$Relese\033[0m] [\033[33m$DIST\033[0m] [\033[33m$VER\033[0m]
|
|||
|
||||
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
|
||||
if [[ "$isDigital" == '20.04' ]] || [[ "$DIST" == 'focal' ]]; then
|
||||
wget --no-check-certificate -qO '/boot/initrd.img' "${LinuxMirror}/dists/${DIST}/main/installer-${VER}/current/legacy-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}/main/installer-${VER}/current/legacy-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
|
||||
else
|
||||
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
|
||||
fi
|
||||
MirrorHost="$(echo "$LinuxMirror" |awk -F'://|/' '{print $2}')";
|
||||
MirrorFolder="$(echo "$LinuxMirror" |awk -F''${MirrorHost}'' '{print $2}')";
|
||||
elif [[ "$linux_relese" == 'centos' ]]; then
|
||||
|
@ -718,12 +740,13 @@ popularity-contest popularity-contest/participate boolean false
|
|||
|
||||
d-i grub-installer/only_debian boolean true
|
||||
d-i grub-installer/bootdev string default
|
||||
d-i grub-installer/force-efi-extra-removable boolean true
|
||||
### d-i grub-installer/force-efi-extra-removable boolean true
|
||||
d-i finish-install/reboot_in_progress note
|
||||
d-i debian-installer/exit/reboot boolean true
|
||||
d-i preseed/late_command string \
|
||||
sed -ri 's/^#?PermitRootLogin.*/PermitRootLogin yes/g' /target/etc/ssh/sshd_config; \
|
||||
sed -ri 's/^#?PasswordAuthentication.*/PasswordAuthentication yes/g' /target/etc/ssh/sshd_config;
|
||||
sed -ri 's/^#?PasswordAuthentication.*/PasswordAuthentication yes/g' /target/etc/ssh/sshd_config; \
|
||||
sed -ri 's/^#Port 22/Port ${ssh_port}/g' /target/etc/ssh/sshd_config;
|
||||
EOF
|
||||
|
||||
[[ "$loaderMode" != "0" ]] && AutoNet='1'
|
||||
|
|
Loading…
Add table
Reference in a new issue