mirror of
https://github.com/teddysun/across.git
synced 2025-01-18 22:09:35 +08:00
Update InstallNET.sh
Format shell script Signed-off-by: Teddysun <i@teddysun.com>
This commit is contained in:
parent
ea46b3c584
commit
846c48b4bd
345
InstallNET.sh
345
InstallNET.sh
@ -150,39 +150,37 @@ while [[ $# -ge 1 ]]; do
|
|||||||
*)
|
*)
|
||||||
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 $(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"
|
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"
|
||||||
exit 1;
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
[[ "$EUID" -ne '0' ]] && echo "Error:This script must be run as root!" && exit 1;
|
[[ "$EUID" -ne '0' ]] && echo "Error:This script must be run as root!" && exit 1
|
||||||
|
|
||||||
function dependence() {
|
function dependence() {
|
||||||
Full='0';
|
Full='0'
|
||||||
for BIN_DEP in `echo "$1" |sed 's/,/\n/g'`
|
for BIN_DEP in $(echo "$1" | sed 's/,/\n/g'); do
|
||||||
do
|
|
||||||
if [[ -n "$BIN_DEP" ]]; then
|
if [[ -n "$BIN_DEP" ]]; then
|
||||||
Found='0';
|
Found='0'
|
||||||
for BIN_PATH in `echo "$PATH" |sed 's/:/\n/g'`
|
for BIN_PATH in $(echo "$PATH" | sed 's/:/\n/g'); do
|
||||||
do
|
ls $BIN_PATH/$BIN_DEP >/dev/null 2>&1
|
||||||
ls $BIN_PATH/$BIN_DEP >/dev/null 2>&1;
|
|
||||||
if [ $? == '0' ]; then
|
if [ $? == '0' ]; then
|
||||||
Found='1';
|
Found='1'
|
||||||
break;
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
if [ "$Found" == '1' ]; then
|
if [ "$Found" == '1' ]; then
|
||||||
echo -en "[\033[32mok\033[0m]\t";
|
echo -en "[\033[32mok\033[0m]\t"
|
||||||
else
|
else
|
||||||
Full='1';
|
Full='1'
|
||||||
echo -en "[\033[31mNot Install\033[0m]";
|
echo -en "[\033[31mNot Install\033[0m]"
|
||||||
fi
|
fi
|
||||||
echo -en "\t$BIN_DEP\n";
|
echo -en "\t$BIN_DEP\n"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
if [ "$Full" == '1' ]; then
|
if [ "$Full" == '1' ]; then
|
||||||
echo -ne "\n\033[31mError! \033[0mPlease use '\033[33mapt-get\033[0m' or '\033[33myum\033[0m' install it.\n\n\n"
|
echo -ne "\n\033[31mError! \033[0mPlease use '\033[33mapt-get\033[0m' or '\033[33myum\033[0m' install it.\n\n\n"
|
||||||
exit 1;
|
exit 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -204,37 +202,35 @@ function selectMirror(){
|
|||||||
declare -A MirrorBackup
|
declare -A MirrorBackup
|
||||||
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")
|
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")
|
||||||
echo "$New" | grep -q '^http://\|^https://\|^ftp://' && MirrorBackup[${Relese}0]="$New"
|
echo "$New" | grep -q '^http://\|^https://\|^ftp://' && MirrorBackup[${Relese}0]="$New"
|
||||||
for mirror in $(echo "${!MirrorBackup[@]}" |sed 's/\ /\n/g' |sort -n |grep "^$Relese")
|
for mirror in $(echo "${!MirrorBackup[@]}" | sed 's/\ /\n/g' | sort -n | grep "^$Relese"); do
|
||||||
do
|
|
||||||
Current="${MirrorBackup[$mirror]}"
|
Current="${MirrorBackup[$mirror]}"
|
||||||
[ -n "$Current" ] || continue
|
[ -n "$Current" ] || continue
|
||||||
MirrorURL=`echo "$TEMP" |sed "s#SUB_MIRROR#${Current}#g"`
|
MirrorURL=$(echo "$TEMP" | sed "s#SUB_MIRROR#${Current}#g")
|
||||||
wget --no-check-certificate --spider --timeout=3 -o /dev/null "$MirrorURL"
|
wget --no-check-certificate --spider --timeout=3 -o /dev/null "$MirrorURL"
|
||||||
[ $? -eq 0 ] && mirrorStatus=1 && break
|
[ $? -eq 0 ] && mirrorStatus=1 && break
|
||||||
done
|
done
|
||||||
[ $mirrorStatus -eq 1 ] && echo "$Current" || exit 1
|
[ ${mirrorStatus} -eq 1 ] && echo "$Current" || exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
function netmask() {
|
function netmask() {
|
||||||
n="${1:-32}"
|
n="${1:-32}"
|
||||||
b=""
|
b=""
|
||||||
m=""
|
m=""
|
||||||
for((i=0;i<32;i++)){
|
for ((i = 0; i < 32; i++)); do
|
||||||
[ $i -lt $n ] && b="${b}1" || b="${b}0"
|
[ $i -lt $n ] && b="${b}1" || b="${b}0"
|
||||||
}
|
done
|
||||||
for((i=0;i<4;i++)){
|
for ((i = 0; i < 4; i++)); do
|
||||||
s=`echo "$b"|cut -c$[$[$i*8]+1]-$[$[$i+1]*8]`
|
s=$(echo "$b" | cut -c$(($(($i * 8)) + 1))-$(($(($i + 1)) * 8)))
|
||||||
[ "$m" == "" ] && m="$((2#${s}))" || m="${m}.$((2#${s}))"
|
[ "$m" == "" ] && m="$((2#${s}))" || m="${m}.$((2#${s}))"
|
||||||
}
|
done
|
||||||
echo "$m"
|
echo "$m"
|
||||||
}
|
}
|
||||||
|
|
||||||
function getInterface() {
|
function getInterface() {
|
||||||
interface=""
|
interface=""
|
||||||
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'`
|
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')
|
||||||
defaultRoute=`ip route show default |grep "^default"`
|
defaultRoute=$(ip route show default | grep "^default")
|
||||||
for item in `echo "$Interfaces"`
|
for item in $(echo "$Interfaces"); do
|
||||||
do
|
|
||||||
[ -n "$item" ] || continue
|
[ -n "$item" ] || continue
|
||||||
echo "$defaultRoute" | grep -q "$item"
|
echo "$defaultRoute" | grep -q "$item"
|
||||||
[ $? -eq 0 ] && interface="$item" && break
|
[ $? -eq 0 ] && interface="$item" && break
|
||||||
@ -243,27 +239,27 @@ function getInterface(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getDisk() {
|
function getDisk() {
|
||||||
disks=`lsblk | sed 's/[[:space:]]*$//g' |grep "disk$" |cut -d' ' -f1 |grep -v "fd[0-9]*\|sr[0-9]*" |head -n1`
|
disks=$(lsblk | sed 's/[[:space:]]*$//g' | grep "disk$" | cut -d' ' -f1 | grep -v "fd[0-9]*\|sr[0-9]*" | head -n1)
|
||||||
[ -n "$disks" ] || echo ""
|
[ -n "$disks" ] || echo ""
|
||||||
echo "$disks" | grep -q "/dev"
|
echo "$disks" | grep -q "/dev"
|
||||||
[ $? -eq 0 ] && echo "$disks" || echo "/dev/$disks"
|
[ $? -eq 0 ] && echo "$disks" || echo "/dev/$disks"
|
||||||
}
|
}
|
||||||
|
|
||||||
function diskType() {
|
function diskType() {
|
||||||
echo `udevadm info --query all "$1" 2>/dev/null |grep 'ID_PART_TABLE_TYPE' |cut -d'=' -f2`
|
echo $(udevadm info --query all "$1" 2>/dev/null | grep 'ID_PART_TABLE_TYPE' | cut -d'=' -f2)
|
||||||
}
|
}
|
||||||
|
|
||||||
function getGrub() {
|
function getGrub() {
|
||||||
Boot="${1:-/boot}"
|
Boot="${1:-/boot}"
|
||||||
folder=`find "$Boot" -type d -name "grub*" 2>/dev/null | sort | tail -n1`
|
folder=$(find "$Boot" -type d -name "grub*" 2>/dev/null | sort | tail -n1)
|
||||||
[ -n "$folder" ] || return
|
[ -n "$folder" ] || return
|
||||||
fileName=`ls -1 "$folder" 2>/dev/null |grep '^grub.conf$\|^grub.cfg$'`
|
fileName=$(ls -1 "$folder" 2>/dev/null | grep '^grub.conf$\|^grub.cfg$')
|
||||||
if [ -z "$fileName" ]; then
|
if [ -z "$fileName" ]; then
|
||||||
ls -1 "$folder" 2>/dev/null | grep -q '^grubenv$'
|
ls -1 "$folder" 2>/dev/null | grep -q '^grubenv$'
|
||||||
[ $? -eq 0 ] || return
|
[ $? -eq 0 ] || return
|
||||||
folder=`find "$Boot" -type f -name "grubenv" 2>/dev/null |xargs dirname |grep -v "^$folder" |head -n1`
|
folder=$(find "$Boot" -type f -name "grubenv" 2>/dev/null | xargs dirname | grep -v "^$folder" | head -n1)
|
||||||
[ -n "$folder" ] || return
|
[ -n "$folder" ] || return
|
||||||
fileName=`ls -1 "$folder" 2>/dev/null |grep '^grub.conf$\|^grub.cfg$'`
|
fileName=$(ls -1 "$folder" 2>/dev/null | grep '^grub.conf$\|^grub.cfg$')
|
||||||
fi
|
fi
|
||||||
[ -n "$fileName" ] || return
|
[ -n "$fileName" ] || return
|
||||||
[ "$fileName" == "grub.cfg" ] && ver="0" || ver="1"
|
[ "$fileName" == "grub.cfg" ] && ver="0" || ver="1"
|
||||||
@ -271,17 +267,17 @@ function getGrub(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
function lowMem() {
|
function lowMem() {
|
||||||
mem=`grep "^MemTotal:" /proc/meminfo 2>/dev/null |grep -o "[0-9]*"`
|
mem=$(grep "^MemTotal:" /proc/meminfo 2>/dev/null | grep -o "[0-9]*")
|
||||||
[ -n "$mem" ] || return 0
|
[ -n "$mem" ] || return 0
|
||||||
[ "$mem" -le "524288" ] && return 1 || return 0
|
[ "$mem" -le "524288" ] && return 1 || return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
if [[ "$loaderMode" == "0" ]]; then
|
if [[ "$loaderMode" == "0" ]]; then
|
||||||
Grub=`getGrub "/boot"`
|
Grub=$(getGrub "/boot")
|
||||||
[ -z "$Grub" ] && echo -ne "Error! Not Found grub.\n" && exit 1;
|
[ -z "$Grub" ] && echo -ne "Error! Not Found grub.\n" && exit 1
|
||||||
GRUBDIR=`echo "$Grub" |cut -d':' -f1`
|
GRUBDIR=$(echo "$Grub" | cut -d':' -f1)
|
||||||
GRUBFILE=`echo "$Grub" |cut -d':' -f2`
|
GRUBFILE=$(echo "$Grub" | cut -d':' -f2)
|
||||||
GRUBVER=`echo "$Grub" |cut -d':' -f3`
|
GRUBVER=$(echo "$Grub" | cut -d':' -f3)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[ -n "$Relese" ] || Relese='Debian'
|
[ -n "$Relese" ] || Relese='Debian'
|
||||||
@ -289,92 +285,95 @@ 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
|
||||||
dependence iconv;
|
dependence iconv
|
||||||
linux_relese='debian';
|
linux_relese='debian'
|
||||||
tmpDIST='bullseye';
|
tmpDIST='bookworm'
|
||||||
tmpVER='amd64';
|
tmpVER='amd64'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[ -n "$ipAddr" ] && [ -n "$ipMask" ] && [ -n "$ipGate" ] && setNet='1';
|
[ -n "$ipAddr" ] && [ -n "$ipMask" ] && [ -n "$ipGate" ] && setNet='1'
|
||||||
if [ "$setNet" == "0" ]; then
|
if [ "$setNet" == "0" ]; then
|
||||||
dependence ip
|
dependence ip
|
||||||
[ -n "$interface" ] || interface=`getInterface`
|
[ -n "$interface" ] || interface=$(getInterface)
|
||||||
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\}'`
|
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\}')
|
||||||
ipAddr=`echo ${iAddr} |cut -d'/' -f1`
|
ipAddr=$(echo ${iAddr} | cut -d'/' -f1)
|
||||||
ipMask=`netmask $(echo ${iAddr} |cut -d'/' -f2)`
|
ipMask=$(netmask $(echo ${iAddr} | cut -d'/' -f2))
|
||||||
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`
|
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)
|
||||||
fi
|
fi
|
||||||
if [ -z "$interface" ]; then
|
if [ -z "$interface" ]; then
|
||||||
dependence ip
|
dependence ip
|
||||||
[ -n "$interface" ] || interface=`getInterface`
|
[ -n "$interface" ] || interface=$(getInterface)
|
||||||
fi
|
fi
|
||||||
IPv4="$ipAddr"; MASK="$ipMask"; GATE="$ipGate";
|
IPv4="$ipAddr"
|
||||||
|
MASK="$ipMask"
|
||||||
|
GATE="$ipGate"
|
||||||
|
|
||||||
[ -n "$IPv4" ] && [ -n "$MASK" ] && [ -n "$GATE" ] && [ -n "$ipDNS" ] || {
|
[ -n "$IPv4" ] && [ -n "$MASK" ] && [ -n "$GATE" ] && [ -n "$ipDNS" ] || {
|
||||||
echo -ne '\nError: Invalid network config\n\n'
|
echo -ne '\nError: Invalid network config\n\n'
|
||||||
bash $0 error;
|
bash $0 error
|
||||||
exit 1;
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
if [[ "$Relese" == 'Debian' ]] || [[ "$Relese" == 'Ubuntu' ]]; then
|
if [[ "$Relese" == 'Debian' ]] || [[ "$Relese" == 'Ubuntu' ]]; then
|
||||||
dependence wget,awk,grep,sed,cut,cat,lsblk,cpio,gzip,find,dirname,basename;
|
dependence wget,awk,grep,sed,cut,cat,lsblk,cpio,gzip,find,dirname,basename
|
||||||
elif [[ "$Relese" == 'CentOS' ]]; then
|
elif [[ "$Relese" == 'CentOS' ]]; then
|
||||||
dependence wget,awk,grep,sed,cut,cat,lsblk,cpio,gzip,find,dirname,basename,file,xz;
|
dependence wget,awk,grep,sed,cut,cat,lsblk,cpio,gzip,find,dirname,basename,file,xz
|
||||||
fi
|
fi
|
||||||
[ -n "$tmpWORD" ] && dependence openssl
|
[[ -n "$tmpWORD" ]] && dependence openssl
|
||||||
[[ -n "$tmpWORD" ]] && myPASSWORD="$(openssl passwd -1 "$tmpWORD")";
|
[[ -n "$tmpWORD" ]] && myPASSWORD="$(openssl passwd -1 "$tmpWORD")"
|
||||||
[[ -z "$myPASSWORD" ]] && myPASSWORD='$1$4BJZaD0A$y1QykUnJ6mXprENfwpseH0';
|
[[ -z "$myPASSWORD" ]] && myPASSWORD='$1$4BJZaD0A$y1QykUnJ6mXprENfwpseH0'
|
||||||
|
|
||||||
tempDisk=`getDisk`; [ -n "$tempDisk" ] && IncDisk="$tempDisk"
|
tempDisk=$(getDisk)
|
||||||
|
[ -n "$tempDisk" ] && IncDisk="$tempDisk"
|
||||||
|
|
||||||
case `uname -m` in aarch64|arm64) VER="arm64";; x86|i386|i686) VER="i386";; x86_64|amd64) VER="amd64";; *) VER="";; esac
|
case $(uname -m) in aarch64 | arm64) VER="arm64" ;; x86 | i386 | i686) VER="i386" ;; x86_64 | amd64) VER="amd64" ;; *) VER="" ;; esac
|
||||||
tmpVER="$(echo "$tmpVER" |sed -r 's/(.*)/\L\1/')";
|
tmpVER="$(echo "$tmpVER" | sed -r 's/(.*)/\L\1/')"
|
||||||
if [[ "$VER" != "arm64" ]] && [[ -n "$tmpVER" ]]; then
|
if [[ "$VER" != "arm64" ]] && [[ -n "$tmpVER" ]]; then
|
||||||
case "$tmpVER" in i386 | i686 | x86 | 32) VER="i386" ;; amd64 | x86_64 | x64 | 64) [[ "$Relese" == 'CentOS' ]] && VER='x86_64' || VER='amd64' ;; *) VER='' ;; esac
|
case "$tmpVER" in i386 | i686 | x86 | 32) VER="i386" ;; amd64 | x86_64 | x64 | 64) [[ "$Relese" == 'CentOS' ]] && VER='x86_64' || VER='amd64' ;; *) VER='' ;; esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ ! -n "$VER" ]]; then
|
if [[ ! -n "$VER" ]]; then
|
||||||
echo "Error! Not Architecture."
|
echo "Error! Not Architecture."
|
||||||
bash $0 error;
|
bash $0 error
|
||||||
exit 1;
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -z "$tmpDIST" ]]; then
|
if [[ -z "$tmpDIST" ]]; then
|
||||||
[ "$Relese" == 'Debian' ] && tmpDIST='buster';
|
[ "$Relese" == 'Debian' ] && tmpDIST='buster'
|
||||||
[ "$Relese" == 'Ubuntu' ] && tmpDIST='bionic';
|
[ "$Relese" == 'Ubuntu' ] && tmpDIST='bionic'
|
||||||
[ "$Relese" == 'CentOS' ] && tmpDIST='6.10';
|
[ "$Relese" == 'CentOS' ] && tmpDIST='6.10'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -n "$tmpDIST" ]]; then
|
if [[ -n "$tmpDIST" ]]; then
|
||||||
if [[ "$Relese" == '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]'
|
||||||
[[ $? -eq '0' ]] && {
|
[[ $? -eq '0' ]] && {
|
||||||
isDigital="$(echo "$DIST" |grep -o '[\.0-9]\{1,\}' |sed -n '1h;1!H;$g;s/\n//g;$p' |cut -d'.' -f1)";
|
isDigital="$(echo "$DIST" | grep -o '[\.0-9]\{1,\}' | sed -n '1h;1!H;$g;s/\n//g;$p' | cut -d'.' -f1)"
|
||||||
[[ -n $isDigital ]] && {
|
[[ -n $isDigital ]] && {
|
||||||
[[ "$isDigital" == '7' ]] && DIST='wheezy';
|
[[ "$isDigital" == '7' ]] && DIST='wheezy'
|
||||||
[[ "$isDigital" == '8' ]] && DIST='jessie';
|
[[ "$isDigital" == '8' ]] && DIST='jessie'
|
||||||
[[ "$isDigital" == '9' ]] && DIST='stretch';
|
[[ "$isDigital" == '9' ]] && DIST='stretch'
|
||||||
[[ "$isDigital" == '10' ]] && DIST='buster';
|
[[ "$isDigital" == '10' ]] && DIST='buster'
|
||||||
[[ "$isDigital" == '11' ]] && DIST='bullseye';
|
[[ "$isDigital" == '11' ]] && DIST='bullseye'
|
||||||
[[ "$isDigital" == '12' ]] && DIST='bookworm';
|
[[ "$isDigital" == '12' ]] && DIST='bookworm'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
LinuxMirror=$(selectMirror "$Relese" "$DIST" "$VER" "$tmpMirror")
|
LinuxMirror=$(selectMirror "$Relese" "$DIST" "$VER" "$tmpMirror")
|
||||||
fi
|
fi
|
||||||
if [[ "$Relese" == '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]'
|
||||||
[[ $? -eq '0' ]] && {
|
[[ $? -eq '0' ]] && {
|
||||||
isDigital="$(echo "$DIST" |grep -o '[\.0-9]\{1,\}' |sed -n '1h;1!H;$g;s/\n//g;$p')";
|
isDigital="$(echo "$DIST" | grep -o '[\.0-9]\{1,\}' | sed -n '1h;1!H;$g;s/\n//g;$p')"
|
||||||
[[ -n $isDigital ]] && {
|
[[ -n $isDigital ]] && {
|
||||||
[[ "$isDigital" == '12.04' ]] && DIST='precise';
|
[[ "$isDigital" == '12.04' ]] && DIST='precise'
|
||||||
[[ "$isDigital" == '14.04' ]] && DIST='trusty';
|
[[ "$isDigital" == '14.04' ]] && DIST='trusty'
|
||||||
[[ "$isDigital" == '16.04' ]] && DIST='xenial';
|
[[ "$isDigital" == '16.04' ]] && DIST='xenial'
|
||||||
[[ "$isDigital" == '18.04' ]] && DIST='bionic';
|
[[ "$isDigital" == '18.04' ]] && DIST='bionic'
|
||||||
[[ "$isDigital" == '20.04' ]] && DIST='focal';
|
[[ "$isDigital" == '20.04' ]] && DIST='focal'
|
||||||
# [[ "$isDigital" == '22.04' ]] && DIST='jammy';
|
# [[ "$isDigital" == '22.04' ]] && DIST='jammy';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -382,50 +381,49 @@ if [[ -n "$tmpDIST" ]]; then
|
|||||||
fi
|
fi
|
||||||
if [[ "$Relese" == 'CentOS' ]]; then
|
if [[ "$Relese" == 'CentOS' ]]; then
|
||||||
SpikCheckDIST='1'
|
SpikCheckDIST='1'
|
||||||
DISTCheck="$(echo "$tmpDIST" |grep -o '[\.0-9]\{1,\}' |head -n1)";
|
DISTCheck="$(echo "$tmpDIST" | grep -o '[\.0-9]\{1,\}' | head -n1)"
|
||||||
LinuxMirror=$(selectMirror "$Relese" "$DISTCheck" "$VER" "$tmpMirror")
|
LinuxMirror=$(selectMirror "$Relese" "$DISTCheck" "$VER" "$tmpMirror")
|
||||||
ListDIST="$(wget --no-check-certificate -qO- "$LinuxMirror/dir_sizes" | cut -f2 | grep '^[0-9]')"
|
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- "$LinuxMirror/$DIST/os/$VER/.treeinfo" |grep -q 'general';
|
wget --no-check-certificate -qO- "$LinuxMirror/$DIST/os/$VER/.treeinfo" | grep -q 'general'
|
||||||
[[ $? != '0' ]] && {
|
[[ $? != '0' ]] && {
|
||||||
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
|
if [[ -z "$LinuxMirror" ]]; then
|
||||||
echo -ne "\033[31mError! \033[0mInvaild mirror! \n"
|
echo -ne "\033[31mError! \033[0mInvaild mirror! \n"
|
||||||
[ "$Relese" == 'Debian' ] && echo -en "\033[33mexample:\033[0m http://deb.debian.org/debian\n\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" == '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";
|
[ "$Relese" == 'CentOS' ] && echo -en "\033[33mexample:\033[0m http://mirror.centos.org/centos\n\n"
|
||||||
bash $0 error;
|
bash $0 error
|
||||||
exit 1;
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$SpikCheckDIST" == '0' ]]; then
|
if [[ "$SpikCheckDIST" == '0' ]]; then
|
||||||
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')";
|
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' && 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'
|
||||||
bash $0 error;
|
bash $0 error
|
||||||
exit 1;
|
exit 1
|
||||||
}
|
}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$ddMode" == '1' ]]; then
|
if [[ "$ddMode" == '1' ]]; then
|
||||||
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://'
|
||||||
[[ $? -ne '0' ]] && echo 'Please input vaild URL, Only support http://, ftp:// and https:// !' && exit 1;
|
[[ $? -ne '0' ]] && echo 'Please input vaild URL, Only support http://, ftp:// and https:// !' && exit 1
|
||||||
# Decompress command selection
|
# Decompress command selection
|
||||||
if echo "$DDURL" | grep -q '.gz'; then
|
if echo "$DDURL" | grep -q '.gz'; then
|
||||||
DEC_CMD="gunzip -dc"
|
DEC_CMD="gunzip -dc"
|
||||||
@ -435,8 +433,8 @@ if [[ "$ddMode" == '1' ]]; then
|
|||||||
echo 'Please input vaild URL, Only support gz or xz file!' && exit 1
|
echo 'Please input vaild URL, Only support gz or xz file!' && exit 1
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo 'Please input vaild image URL! ';
|
echo 'Please input vaild image URL! '
|
||||||
exit 1;
|
exit 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -456,13 +454,13 @@ 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
|
||||||
UNKNOWHW='1';
|
UNKNOWHW='1'
|
||||||
echo -en "\033[33mThe version lower then \033[31m$UNVER\033[33m may not support in auto mode! \033[0m\n";
|
echo -en "\033[33mThe version lower then \033[31m$UNVER\033[33m may not support in auto mode! \033[0m\n"
|
||||||
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.10 \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
|
||||||
@ -475,8 +473,8 @@ if [[ "$linux_relese" == 'debian' ]] || [[ "$linux_relese" == 'ubuntu' ]]; then
|
|||||||
[[ $? -ne '0' ]] && echo -ne "\033[31mError! \033[0mDownload 'initrd.img' for \033[33m$linux_relese\033[0m failed! \n" && exit 1
|
[[ $? -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 '/tmp/vmlinuz' "${LinuxMirror}/dists/${DIST}${inUpdate}/main/installer-${VER}/current/${legacy}images/netboot/${linux_relese}-installer/${VER}/linux"
|
wget --no-check-certificate -qO '/tmp/vmlinuz' "${LinuxMirror}/dists/${DIST}${inUpdate}/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
|
[[ $? -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}')";
|
MirrorHost="$(echo "$LinuxMirror" | awk -F'://|/' '{print $2}')"
|
||||||
MirrorFolder="$(echo "$LinuxMirror" |awk -F''${MirrorHost}'' '{print $2}')";
|
MirrorFolder="$(echo "$LinuxMirror" | awk -F''${MirrorHost}'' '{print $2}')"
|
||||||
[ -n "$MirrorFolder" ] || MirrorFolder="/"
|
[ -n "$MirrorFolder" ] || MirrorFolder="/"
|
||||||
elif [[ "$linux_relese" == 'centos' ]]; then
|
elif [[ "$linux_relese" == 'centos' ]]; then
|
||||||
wget --no-check-certificate -qO '/tmp/initrd.img' "${LinuxMirror}/${DIST}/os/${VER}/isolinux/initrd.img"
|
wget --no-check-certificate -qO '/tmp/initrd.img' "${LinuxMirror}/${DIST}/os/${VER}/isolinux/initrd.img"
|
||||||
@ -484,8 +482,8 @@ elif [[ "$linux_relese" == 'centos' ]]; then
|
|||||||
wget --no-check-certificate -qO '/tmp/vmlinuz' "${LinuxMirror}/${DIST}/os/${VER}/isolinux/vmlinuz"
|
wget --no-check-certificate -qO '/tmp/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
|
[[ $? -ne '0' ]] && echo -ne "\033[31mError! \033[0mDownload 'vmlinuz' for \033[33m$linux_relese\033[0m failed! \n" && exit 1
|
||||||
else
|
else
|
||||||
bash $0 error;
|
bash $0 error
|
||||||
exit 1;
|
exit 1
|
||||||
fi
|
fi
|
||||||
if [[ "$linux_relese" == 'debian' ]]; then
|
if [[ "$linux_relese" == 'debian' ]]; then
|
||||||
if [[ "$IncFirmware" == '1' ]]; then
|
if [[ "$IncFirmware" == '1' ]]; then
|
||||||
@ -493,17 +491,17 @@ if [[ "$linux_relese" == 'debian' ]]; then
|
|||||||
[[ $? -ne '0' ]] && echo -ne "\033[31mError! \033[0mDownload 'firmware' for \033[33m$linux_relese\033[0m failed! \n" && exit 1
|
[[ $? -ne '0' ]] && echo -ne "\033[31mError! \033[0mDownload 'firmware' for \033[33m$linux_relese\033[0m failed! \n" && exit 1
|
||||||
fi
|
fi
|
||||||
if [[ "$ddMode" == '1' ]]; then
|
if [[ "$ddMode" == '1' ]]; then
|
||||||
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)
|
vKernel_udeb=$(wget --no-check-certificate -qO- "http://$LinuxMirror/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="4.19.0-17"
|
[[ -z "vKernel_udeb" ]] && vKernel_udeb="6.1.0-10"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$loaderMode" == "0" ]]; then
|
if [[ "$loaderMode" == "0" ]]; then
|
||||||
[[ ! -f "${GRUBDIR}/${GRUBFILE}" ]] && echo "Error! Not Found ${GRUBFILE}. " && exit 1;
|
[[ ! -f "${GRUBDIR}/${GRUBFILE}" ]] && echo "Error! Not Found ${GRUBFILE}. " && exit 1
|
||||||
|
|
||||||
[[ ! -f "${GRUBDIR}/${GRUBFILE}.old" ]] && [[ -f "${GRUBDIR}/${GRUBFILE}.bak" ]] && mv -f "${GRUBDIR}/${GRUBFILE}.bak" "${GRUBDIR}/${GRUBFILE}.old";
|
[[ ! -f "${GRUBDIR}/${GRUBFILE}.old" ]] && [[ -f "${GRUBDIR}/${GRUBFILE}.bak" ]] && mv -f "${GRUBDIR}/${GRUBFILE}.bak" "${GRUBDIR}/${GRUBFILE}.old"
|
||||||
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
|
||||||
GRUBVER='-1'
|
GRUBVER='-1'
|
||||||
fi
|
fi
|
||||||
@ -513,50 +511,49 @@ fi
|
|||||||
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 ')"
|
||||||
if [[ "$LoadNum" -eq '1' ]]; then
|
if [[ "$LoadNum" -eq '1' ]]; then
|
||||||
cat $READGRUB |sed '/^$/d' >/tmp/grub.new;
|
cat $READGRUB | sed '/^$/d' >/tmp/grub.new
|
||||||
elif [[ "$LoadNum" -gt '1' ]]; then
|
elif [[ "$LoadNum" -gt '1' ]]; then
|
||||||
CFG0="$(awk '/menuentry /{print NR}' $READGRUB|head -n 1)";
|
CFG0="$(awk '/menuentry /{print NR}' $READGRUB | head -n 1)"
|
||||||
CFG2="$(awk '/menuentry /{print NR}' $READGRUB|head -n 2 |tail -n 1)";
|
CFG2="$(awk '/menuentry /{print NR}' $READGRUB | head -n 2 | tail -n 1)"
|
||||||
CFG1="";
|
CFG1=""
|
||||||
for tmpCFG in `awk '/}/{print NR}' $READGRUB`
|
for tmpCFG in $(awk '/}/{print NR}' $READGRUB); do
|
||||||
do
|
[ "$tmpCFG" -gt "$CFG0" -a "$tmpCFG" -lt "$CFG2" ] && CFG1="$tmpCFG"
|
||||||
[ "$tmpCFG" -gt "$CFG0" -a "$tmpCFG" -lt "$CFG2" ] && CFG1="$tmpCFG";
|
|
||||||
done
|
done
|
||||||
[[ -z "$CFG1" ]] && {
|
[[ -z "$CFG1" ]] && {
|
||||||
echo "Error! read $GRUBFILE. ";
|
echo "Error! read $GRUBFILE. "
|
||||||
exit 1;
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
sed -n "$CFG0,$CFG1"p $READGRUB >/tmp/grub.new;
|
sed -n "$CFG0,$CFG1"p $READGRUB >/tmp/grub.new
|
||||||
[[ -f /tmp/grub.new ]] && [[ "$(grep -c '{' /tmp/grub.new)" -eq "$(grep -c '}' /tmp/grub.new)" ]] || {
|
[[ -f /tmp/grub.new ]] && [[ "$(grep -c '{' /tmp/grub.new)" -eq "$(grep -c '}' /tmp/grub.new)" ]] || {
|
||||||
echo -ne "\033[31mError! \033[0mNot configure $GRUBFILE. \n";
|
echo -ne "\033[31mError! \033[0mNot configure $GRUBFILE. \n"
|
||||||
exit 1;
|
exit 1
|
||||||
}
|
}
|
||||||
fi
|
fi
|
||||||
[ ! -f /tmp/grub.new ] && echo "Error! $GRUBFILE. " && exit 1;
|
[ ! -f /tmp/grub.new ] && echo "Error! $GRUBFILE. " && exit 1
|
||||||
sed -i "/menuentry.*/c\menuentry\ \'Install OS \[$DIST\ $VER\]\'\ --class debian\ --class\ gnu-linux\ --class\ gnu\ --class\ os\ \{" /tmp/grub.new
|
sed -i "/menuentry.*/c\menuentry\ \'Install OS \[$DIST\ $VER\]\'\ --class debian\ --class\ gnu-linux\ --class\ gnu\ --class\ os\ \{" /tmp/grub.new
|
||||||
sed -i "/echo.*Loading/d" /tmp/grub.new;
|
sed -i "/echo.*Loading/d" /tmp/grub.new
|
||||||
INSERTGRUB="$(awk '/menuentry /{print NR}' $GRUBDIR/$GRUBFILE | head -n 1)"
|
INSERTGRUB="$(awk '/menuentry /{print NR}' $GRUBDIR/$GRUBFILE | head -n 1)"
|
||||||
}
|
}
|
||||||
|
|
||||||
[[ "$GRUBVER" == '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
|
||||||
[[ -n $CFG0 ]] && [ -z $CFG1 -o $CFG1 != $CFG0 ] && sed -n "$CFG0,$[$CFG1-1]"p $GRUBDIR/$GRUBFILE >/tmp/grub.new;
|
[[ -n $CFG0 ]] && [ -z $CFG1 -o $CFG1 != $CFG0 ] && sed -n "$CFG0,$(($CFG1 - 1))"p $GRUBDIR/$GRUBFILE >/tmp/grub.new
|
||||||
[[ ! -f /tmp/grub.new ]] && echo "Error! configure append $GRUBFILE. " && exit 1;
|
[[ ! -f /tmp/grub.new ]] && echo "Error! configure append $GRUBFILE. " && exit 1
|
||||||
sed -i "/title.*/c\title\ \'Install OS \[$DIST\ $VER\]\'" /tmp/grub.new;
|
sed -i "/title.*/c\title\ \'Install OS \[$DIST\ $VER\]\'" /tmp/grub.new
|
||||||
sed -i '/^#/d' /tmp/grub.new;
|
sed -i '/^#/d' /tmp/grub.new
|
||||||
INSERTGRUB="$(awk '/title[\ ]|title[\t]/{print NR}' $GRUBDIR/$GRUBFILE | head -n 1)"
|
INSERTGRUB="$(awk '/title[\ ]|title[\t]/{print NR}' $GRUBDIR/$GRUBFILE | head -n 1)"
|
||||||
}
|
}
|
||||||
|
|
||||||
if [[ "$loaderMode" == "0" ]]; then
|
if [[ "$loaderMode" == "0" ]]; then
|
||||||
[[ -n "$(grep 'linux.*/\|kernel.*/' /tmp/grub.new |awk '{print $2}' |tail -n 1 |grep '^/boot/')" ]] && Type='InBoot' || Type='NoBoot';
|
[[ -n "$(grep 'linux.*/\|kernel.*/' /tmp/grub.new | awk '{print $2}' | tail -n 1 | grep '^/boot/')" ]] && Type='InBoot' || Type='NoBoot'
|
||||||
|
|
||||||
LinuxKernel="$(grep 'linux.*/\|kernel.*/' /tmp/grub.new |awk '{print $1}' |head -n 1)";
|
LinuxKernel="$(grep 'linux.*/\|kernel.*/' /tmp/grub.new | awk '{print $1}' | head -n 1)"
|
||||||
[[ -z "$LinuxKernel" ]] && echo "Error! read grub config! " && exit 1;
|
[[ -z "$LinuxKernel" ]] && echo "Error! read grub config! " && exit 1
|
||||||
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'
|
||||||
|
|
||||||
[[ "$setInterfaceName" == "1" ]] && Add_OPTION="net.ifnames=0 biosdevname=0" || Add_OPTION=""
|
[[ "$setInterfaceName" == "1" ]] && Add_OPTION="net.ifnames=0 biosdevname=0" || Add_OPTION=""
|
||||||
[[ "$setIPv6" == "1" ]] && Add_OPTION="$Add_OPTION ipv6.disable=1"
|
[[ "$setIPv6" == "1" ]] && Add_OPTION="$Add_OPTION ipv6.disable=1"
|
||||||
@ -572,35 +569,34 @@ if [[ "$loaderMode" == "0" ]]; then
|
|||||||
[ -n "$setConsole" ] && BOOT_OPTION="$BOOT_OPTION --- console=$setConsole"
|
[ -n "$setConsole" ] && BOOT_OPTION="$BOOT_OPTION --- console=$setConsole"
|
||||||
|
|
||||||
[[ "$Type" == 'InBoot' ]] && {
|
[[ "$Type" == 'InBoot' ]] && {
|
||||||
sed -i "/$LinuxKernel.*\//c\\\t$LinuxKernel\\t\/boot\/vmlinuz $BOOT_OPTION" /tmp/grub.new;
|
sed -i "/$LinuxKernel.*\//c\\\t$LinuxKernel\\t\/boot\/vmlinuz $BOOT_OPTION" /tmp/grub.new
|
||||||
sed -i "/$LinuxIMG.*\//c\\\t$LinuxIMG\\t\/boot\/initrd.img" /tmp/grub.new;
|
sed -i "/$LinuxIMG.*\//c\\\t$LinuxIMG\\t\/boot\/initrd.img" /tmp/grub.new
|
||||||
}
|
}
|
||||||
|
|
||||||
[[ "$Type" == 'NoBoot' ]] && {
|
[[ "$Type" == 'NoBoot' ]] && {
|
||||||
sed -i "/$LinuxKernel.*\//c\\\t$LinuxKernel\\t\/vmlinuz $BOOT_OPTION" /tmp/grub.new;
|
sed -i "/$LinuxKernel.*\//c\\\t$LinuxKernel\\t\/vmlinuz $BOOT_OPTION" /tmp/grub.new
|
||||||
sed -i "/$LinuxIMG.*\//c\\\t$LinuxIMG\\t\/initrd.img" /tmp/grub.new;
|
sed -i "/$LinuxIMG.*\//c\\\t$LinuxIMG\\t\/initrd.img" /tmp/grub.new
|
||||||
}
|
}
|
||||||
|
|
||||||
sed -i '$a\\n' /tmp/grub.new;
|
sed -i '$a\\n' /tmp/grub.new
|
||||||
|
|
||||||
sed -i ''${INSERTGRUB}'i\\n' $GRUBDIR/$GRUBFILE;
|
sed -i ''${INSERTGRUB}'i\\n' $GRUBDIR/$GRUBFILE
|
||||||
sed -i ''${INSERTGRUB}'r /tmp/grub.new' $GRUBDIR/$GRUBFILE;
|
sed -i ''${INSERTGRUB}'r /tmp/grub.new' $GRUBDIR/$GRUBFILE
|
||||||
[[ -f $GRUBDIR/grubenv ]] && sed -i 's/saved_entry/#saved_entry/g' $GRUBDIR/grubenv;
|
[[ -f $GRUBDIR/grubenv ]] && sed -i 's/saved_entry/#saved_entry/g' $GRUBDIR/grubenv
|
||||||
fi
|
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 [[ "$linux_relese" == 'debian' ]] || [[ "$linux_relese" == 'ubuntu' ]]; then
|
if [[ "$linux_relese" == 'debian' ]] || [[ "$linux_relese" == 'ubuntu' ]]; then
|
||||||
COMPTYPE="gzip";
|
COMPTYPE="gzip"
|
||||||
elif [[ "$linux_relese" == 'centos' ]]; then
|
elif [[ "$linux_relese" == 'centos' ]]; then
|
||||||
COMPTYPE="$(file ../initrd.img | grep -o ':.*compressed data' | cut -d' ' -f2 | sed -r 's/(.*)/\L\1/' | head -n1)"
|
COMPTYPE="$(file ../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
|
||||||
CompDected='0'
|
CompDected='0'
|
||||||
for COMP in `echo -en 'gzip\nlzma\nxz'`
|
for COMP in $(echo -en 'gzip\nlzma\nxz'); do
|
||||||
do
|
|
||||||
if [[ "$COMPTYPE" == "$COMP" ]]; then
|
if [[ "$COMPTYPE" == "$COMP" ]]; then
|
||||||
CompDected='1'
|
CompDected='1'
|
||||||
if [[ "$COMPTYPE" == 'gzip' ]]; then
|
if [[ "$COMPTYPE" == 'gzip' ]]; then
|
||||||
@ -609,18 +605,18 @@ for COMP in `echo -en 'gzip\nlzma\nxz'`
|
|||||||
NewIMG="initrd.img.$COMPTYPE"
|
NewIMG="initrd.img.$COMPTYPE"
|
||||||
fi
|
fi
|
||||||
mv -f "/tmp/initrd.img" "/tmp/$NewIMG"
|
mv -f "/tmp/initrd.img" "/tmp/$NewIMG"
|
||||||
break;
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
[[ "$CompDected" != '1' ]] && echo "Detect compressed type not support." && exit 1;
|
[[ "$CompDected" != '1' ]] && echo "Detect compressed type not support." && exit 1
|
||||||
[[ "$COMPTYPE" == 'lzma' ]] && UNCOMP='xz --format=lzma --decompress';
|
[[ "$COMPTYPE" == 'lzma' ]] && UNCOMP='xz --format=lzma --decompress'
|
||||||
[[ "$COMPTYPE" == 'xz' ]] && UNCOMP='xz --decompress';
|
[[ "$COMPTYPE" == 'xz' ]] && UNCOMP='xz --decompress'
|
||||||
[[ "$COMPTYPE" == 'gzip' ]] && UNCOMP='gzip -d';
|
[[ "$COMPTYPE" == 'gzip' ]] && UNCOMP='gzip -d'
|
||||||
|
|
||||||
$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 [[ "$linux_relese" == 'debian' ]] || [[ "$linux_relese" == 'ubuntu' ]]; then
|
if [[ "$linux_relese" == 'debian' ]] || [[ "$linux_relese" == 'ubuntu' ]]; then
|
||||||
CurrentKernelVersion=`ls -1 ./lib/modules 2>/dev/null |head -n1`
|
CurrentKernelVersion=$(ls -1 ./lib/modules 2>/dev/null | head -n1)
|
||||||
[ -n "$CurrentKernelVersion" ] && SelectLowmem="di-utils-exit-installer,driver-injection-disk-detect,fdisk-udeb,netcfg-static,parted-udeb,partman-auto,partman-ext3,ata-modules-${CurrentKernelVersion}-di,efi-modules-${CurrentKernelVersion}-di,sata-modules-${CurrentKernelVersion}-di,scsi-modules-${CurrentKernelVersion}-di,scsi-nic-modules-${CurrentKernelVersion}-di" || SelectLowmem=""
|
[ -n "$CurrentKernelVersion" ] && SelectLowmem="di-utils-exit-installer,driver-injection-disk-detect,fdisk-udeb,netcfg-static,parted-udeb,partman-auto,partman-ext3,ata-modules-${CurrentKernelVersion}-di,efi-modules-${CurrentKernelVersion}-di,sata-modules-${CurrentKernelVersion}-di,scsi-modules-${CurrentKernelVersion}-di,scsi-nic-modules-${CurrentKernelVersion}-di" || SelectLowmem=""
|
||||||
cat >/tmp/boot/preseed.cfg <<EOF
|
cat >/tmp/boot/preseed.cfg <<EOF
|
||||||
d-i debian-installer/locale string en_US.UTF-8
|
d-i debian-installer/locale string en_US.UTF-8
|
||||||
@ -729,17 +725,17 @@ fi
|
|||||||
|
|
||||||
[[ "$ddMode" == '1' ]] && {
|
[[ "$ddMode" == '1' ]] && {
|
||||||
WinNoDHCP() {
|
WinNoDHCP() {
|
||||||
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';
|
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'
|
||||||
}
|
}
|
||||||
WinRDP() {
|
WinRDP() {
|
||||||
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';
|
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'
|
||||||
}
|
}
|
||||||
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';
|
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'
|
||||||
[[ "$setNet" == '1' ]] && WinNoDHCP;
|
[[ "$setNet" == '1' ]] && WinNoDHCP
|
||||||
[[ "$setNet" == '0' ]] && [[ "$AutoNet" == '0' ]] && WinNoDHCP;
|
[[ "$setNet" == '0' ]] && [[ "$AutoNet" == '0' ]] && WinNoDHCP
|
||||||
[[ "$setRDP" == '1' ]] && [[ -n "$WinRemote" ]] && WinRDP
|
[[ "$setRDP" == '1' ]] && [[ -n "$WinRemote" ]] && WinRDP
|
||||||
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';
|
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'
|
||||||
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';
|
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'
|
||||||
iconv -f 'UTF-8' -t 'GBK' '/tmp/boot/net.tmp' -o '/tmp/boot/net.bat'
|
iconv -f 'UTF-8' -t 'GBK' '/tmp/boot/net.tmp' -o '/tmp/boot/net.bat'
|
||||||
rm -rf '/tmp/boot/net.tmp'
|
rm -rf '/tmp/boot/net.tmp'
|
||||||
}
|
}
|
||||||
@ -786,12 +782,11 @@ rm -rf /root/install.*log
|
|||||||
|
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
|
||||||
[[ "$UNKNOWHW" == '1' ]] && sed -i 's/^unsupported_hardware/#unsupported_hardware/g' /tmp/boot/ks.cfg
|
[[ "$UNKNOWHW" == '1' ]] && sed -i 's/^unsupported_hardware/#unsupported_hardware/g' /tmp/boot/ks.cfg
|
||||||
[[ "$(echo "$DIST" | grep -o '^[0-9]\{1\}')" == '5' ]] && sed -i '0,/^%end/s//#%end/' /tmp/boot/ks.cfg
|
[[ "$(echo "$DIST" | grep -o '^[0-9]\{1\}')" == '5' ]] && sed -i '0,/^%end/s//#%end/' /tmp/boot/ks.cfg
|
||||||
fi
|
fi
|
||||||
|
|
||||||
find . | cpio -H newc --create --verbose | gzip -9 > /tmp/initrd.img;
|
find . | cpio -H newc --create --verbose | gzip -9 >/tmp/initrd.img
|
||||||
cp -f /tmp/initrd.img /boot/initrd.img || sudo cp -f /tmp/initrd.img /boot/initrd.img
|
cp -f /tmp/initrd.img /boot/initrd.img || sudo cp -f /tmp/initrd.img /boot/initrd.img
|
||||||
cp -f /tmp/vmlinuz /boot/vmlinuz || sudo cp -f /tmp/vmlinuz /boot/vmlinuz
|
cp -f /tmp/vmlinuz /boot/vmlinuz || sudo cp -f /tmp/vmlinuz /boot/vmlinuz
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user