mirror of
https://github.com/dockur/windows.git
synced 2025-12-21 14:41:49 +00:00
Compare commits
8 Commits
5959879b25
...
e3e3a45697
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e3e3a45697 | ||
|
|
adc4eda4f2 | ||
|
|
49090dcbc4 | ||
|
|
ceaacaeb2c | ||
|
|
28580ba276 | ||
|
|
0903fad26b | ||
|
|
d08b7aeb27 | ||
|
|
2239792fa9 |
@ -23,7 +23,7 @@ parseVersion() {
|
|||||||
if [[ "${VERSION}" == \"*\" || "${VERSION}" == \'*\' ]]; then
|
if [[ "${VERSION}" == \"*\" || "${VERSION}" == \'*\' ]]; then
|
||||||
VERSION="${VERSION:1:-1}"
|
VERSION="${VERSION:1:-1}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
VERSION=$(expr "$VERSION" : "^\ *\(.*[^ ]\)\ *$")
|
VERSION=$(expr "$VERSION" : "^\ *\(.*[^ ]\)\ *$")
|
||||||
[ -z "$VERSION" ] && VERSION="win11"
|
[ -z "$VERSION" ] && VERSION="win11"
|
||||||
|
|
||||||
@ -135,8 +135,12 @@ parseVersion() {
|
|||||||
"2003" | "2003r2" | "win2003" | "win2003r2" | "windows2003" | "windows 2003" )
|
"2003" | "2003r2" | "win2003" | "win2003r2" | "windows2003" | "windows 2003" )
|
||||||
VERSION="win2003r2"
|
VERSION="win2003r2"
|
||||||
;;
|
;;
|
||||||
"core11" | "core 11" )
|
"nano11" | "nano 11" )
|
||||||
VERSION="core11"
|
VERSION="nano11"
|
||||||
|
[ -z "$DETECTED" ] && DETECTED="win11x64"
|
||||||
|
;;
|
||||||
|
"" | "core 11" )
|
||||||
|
VERSION=""
|
||||||
[ -z "$DETECTED" ] && DETECTED="win11x64"
|
[ -z "$DETECTED" ] && DETECTED="win11x64"
|
||||||
;;
|
;;
|
||||||
"tiny11" | "tiny 11" )
|
"tiny11" | "tiny 11" )
|
||||||
@ -432,6 +436,7 @@ printVersion() {
|
|||||||
"tiny11"* ) desc="Tiny 11" ;;
|
"tiny11"* ) desc="Tiny 11" ;;
|
||||||
"tiny10"* ) desc="Tiny 10" ;;
|
"tiny10"* ) desc="Tiny 10" ;;
|
||||||
"core11"* ) desc="Core 11" ;;
|
"core11"* ) desc="Core 11" ;;
|
||||||
|
"nano11"* ) desc="Nano 11" ;;
|
||||||
"win7"* ) desc="Windows 7" ;;
|
"win7"* ) desc="Windows 7" ;;
|
||||||
"win8"* ) desc="Windows 8" ;;
|
"win8"* ) desc="Windows 8" ;;
|
||||||
"win10"* ) desc="Windows 10" ;;
|
"win10"* ) desc="Windows 10" ;;
|
||||||
@ -570,6 +575,9 @@ fromFile() {
|
|||||||
*"winvista"* | *"win_vista"* | *"windowsvista"* | *"windows_vista"* )
|
*"winvista"* | *"win_vista"* | *"windowsvista"* | *"windows_vista"* )
|
||||||
id="winvista${arch}"
|
id="winvista${arch}"
|
||||||
;;
|
;;
|
||||||
|
"nano11"* | "nano_11"* )
|
||||||
|
id="nano11"
|
||||||
|
;;
|
||||||
"tiny11core"* | "tiny11_core"* | "tiny_11_core"* )
|
"tiny11core"* | "tiny11_core"* | "tiny_11_core"* )
|
||||||
id="core11"
|
id="core11"
|
||||||
;;
|
;;
|
||||||
@ -1093,6 +1101,11 @@ getLink4() {
|
|||||||
[[ "${lang,,}" != "en" ]] && [[ "${lang,,}" != "en-us" ]] && return 0
|
[[ "${lang,,}" != "en" ]] && [[ "${lang,,}" != "en-us" ]] && return 0
|
||||||
|
|
||||||
case "${id,,}" in
|
case "${id,,}" in
|
||||||
|
"nano11" )
|
||||||
|
size=2159738880
|
||||||
|
sum="78f0f44444ff95b97125b43e560a72e0d6ce0a665cf9f5573bf268191e5510c1"
|
||||||
|
url="nano11_25h2/nano11%2025h2.iso"
|
||||||
|
;;
|
||||||
"core11" )
|
"core11" )
|
||||||
size=2159738880
|
size=2159738880
|
||||||
sum="78f0f44444ff95b97125b43e560a72e0d6ce0a665cf9f5573bf268191e5510c1"
|
sum="78f0f44444ff95b97125b43e560a72e0d6ce0a665cf9f5573bf268191e5510c1"
|
||||||
|
|||||||
130
src/install.sh
130
src/install.sh
@ -5,45 +5,92 @@ ETFS="boot/etfsboot.com"
|
|||||||
FB="falling back to manual installation!"
|
FB="falling back to manual installation!"
|
||||||
EFISYS="efi/microsoft/boot/efisys_noprompt.bin"
|
EFISYS="efi/microsoft/boot/efisys_noprompt.bin"
|
||||||
|
|
||||||
|
backup () {
|
||||||
|
|
||||||
|
local count=1
|
||||||
|
local iso="$1"
|
||||||
|
local name="unknown"
|
||||||
|
local root="$STORAGE/backups"
|
||||||
|
local previous="$STORAGE/windows.base"
|
||||||
|
|
||||||
|
if [ -f "$previous" ]; then
|
||||||
|
|
||||||
|
previous=$(<"$previous")
|
||||||
|
previous="${previous//[![:print:]]/}"
|
||||||
|
|
||||||
|
[ -n "$previous" ] && name="${previous%.*}"
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
mkdir -p "$root"
|
||||||
|
local folder="$name"
|
||||||
|
local dir="$root/$folder"
|
||||||
|
|
||||||
|
while [ -d "$dir" ]
|
||||||
|
do
|
||||||
|
count=$[$count +1]
|
||||||
|
folder="${name}.${count}"
|
||||||
|
dir="$root/$folder"
|
||||||
|
done
|
||||||
|
|
||||||
|
rm -rf "$dir"
|
||||||
|
mkdir -p "$dir"
|
||||||
|
|
||||||
|
[ -f "$iso" ] && mv -f "$iso" "$dir/"
|
||||||
|
find "$STORAGE" -maxdepth 1 -type f -iname 'data.*' -not -iname '*.iso' -exec mv -n {} "$dir/" \;
|
||||||
|
find "$STORAGE" -maxdepth 1 -type f -iname 'windows.*' -not -iname '*.iso' -exec mv -n {} "$dir/" \;
|
||||||
|
find "$STORAGE" -maxdepth 1 -type f \( -iname '*.rom' -or -iname '*.vars' \) -exec mv -n {} "$dir/" \;
|
||||||
|
|
||||||
|
[ -z "$(ls -A "$dir")" ] && rm -rf "$dir"
|
||||||
|
[ -z "$(ls -A "$root")" ] && rm -rf "$root"
|
||||||
|
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
skipInstall() {
|
skipInstall() {
|
||||||
|
|
||||||
local iso="$1"
|
local iso="$1"
|
||||||
local method=""
|
local method=""
|
||||||
local dir magic byte
|
local magic byte
|
||||||
local boot="$STORAGE/windows.boot"
|
local boot="$STORAGE/windows.boot"
|
||||||
local previous="$STORAGE/windows.base"
|
local previous="$STORAGE/windows.base"
|
||||||
|
|
||||||
if [ -f "$previous" ]; then
|
if [ -f "$previous" ]; then
|
||||||
|
|
||||||
previous=$(<"$previous")
|
previous=$(<"$previous")
|
||||||
previous="${previous//[![:print:]]/}"
|
previous="${previous//[![:print:]]/}"
|
||||||
|
|
||||||
if [ -n "$previous" ]; then
|
if [ -n "$previous" ]; then
|
||||||
if [[ "${STORAGE,,}/${previous,,}" != "${iso,,}" ]]; then
|
if [[ "${STORAGE,,}/${previous,,}" != "${iso,,}" ]]; then
|
||||||
if [ -f "$boot" ] && hasDisk; then
|
|
||||||
if [[ "${iso,,}" == "${STORAGE,,}/windows."* ]]; then
|
if ! hasDisk; then
|
||||||
method="your custom .iso file"
|
|
||||||
else
|
rm -f "$STORAGE/$previous"
|
||||||
if [[ "${previous,,}" != "windows."* ]]; then
|
return 1
|
||||||
method="the VERSION variable"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
if [ -n "$method" ]; then
|
|
||||||
info "Detected that $method was changed, will create a backup of your previous installation."
|
|
||||||
fi
|
|
||||||
local i=2
|
|
||||||
dir="${previous%.*}"
|
|
||||||
while [[ $i -le 99 ]] && [ -d "$STORAGE/$dir" ]
|
|
||||||
do
|
|
||||||
dir="${previous%.*}-$i"
|
|
||||||
i=$(expr $i + 1)
|
|
||||||
done
|
|
||||||
mkdir -p "$STORAGE/$dir"
|
|
||||||
find "$STORAGE" -maxdepth 1 -type f -name '*' -exec mv -n {} $STORAGE/$dir/ \;
|
|
||||||
return 0
|
|
||||||
fi
|
fi
|
||||||
rm -f "$STORAGE/$previous"
|
|
||||||
|
if [[ "${iso,,}" == "${STORAGE,,}/windows."* ]]; then
|
||||||
|
method="your custom .iso file was changed"
|
||||||
|
else
|
||||||
|
if [[ "${previous,,}" != "windows."* ]]; then
|
||||||
|
method="the VERSION variable was changed"
|
||||||
|
else
|
||||||
|
method="your custom .iso file was removed"
|
||||||
|
|
||||||
|
if [ -f "$boot" ]; then
|
||||||
|
info "Detected that $method, will be ignored."
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
info "Detected that $method, a backup of your previous installation will be saved..."
|
||||||
|
! backup "$STORAGE/$previous" && error "Backup failed!"
|
||||||
|
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -60,8 +107,10 @@ skipInstall() {
|
|||||||
byte="16" && [[ "$MANUAL" == [Yy1]* ]] && byte="17"
|
byte="16" && [[ "$MANUAL" == [Yy1]* ]] && byte="17"
|
||||||
|
|
||||||
if [[ "$magic" != "$byte" ]]; then
|
if [[ "$magic" != "$byte" ]]; then
|
||||||
|
|
||||||
info "The ISO will be processed again because the configuration was changed..."
|
info "The ISO will be processed again because the configuration was changed..."
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
@ -101,7 +150,11 @@ startInstall() {
|
|||||||
rm -rf "$TMP"
|
rm -rf "$TMP"
|
||||||
|
|
||||||
skipInstall "$BOOT" && return 1
|
skipInstall "$BOOT" && return 1
|
||||||
|
|
||||||
|
if hasDisk; then
|
||||||
|
! backup "" && error "Backup failed!"
|
||||||
|
fi
|
||||||
|
|
||||||
mkdir -p "$TMP"
|
mkdir -p "$TMP"
|
||||||
|
|
||||||
if [ -z "$CUSTOM" ]; then
|
if [ -z "$CUSTOM" ]; then
|
||||||
@ -116,6 +169,11 @@ startInstall() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
rm -f "$BOOT"
|
rm -f "$BOOT"
|
||||||
|
|
||||||
|
find "$STORAGE" -maxdepth 1 -type f -iname 'data.*' -not -iname '*.iso' -delete
|
||||||
|
find "$STORAGE" -maxdepth 1 -type f -iname 'windows.*' -not -iname '*.iso' -delete
|
||||||
|
find "$STORAGE" -maxdepth 1 -type f \( -iname '*.rom' -or -iname '*.vars' \) -delete
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -137,16 +195,6 @@ finishInstall() {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rm -f "$STORAGE/windows.old"
|
|
||||||
rm -f "$STORAGE/windows.vga"
|
|
||||||
rm -f "$STORAGE/windows.net"
|
|
||||||
rm -f "$STORAGE/windows.usb"
|
|
||||||
rm -f "$STORAGE/windows.args"
|
|
||||||
rm -f "$STORAGE/windows.base"
|
|
||||||
rm -f "$STORAGE/windows.boot"
|
|
||||||
rm -f "$STORAGE/windows.mode"
|
|
||||||
rm -f "$STORAGE/windows.type"
|
|
||||||
|
|
||||||
cp -f /run/version "$STORAGE/windows.ver"
|
cp -f /run/version "$STORAGE/windows.ver"
|
||||||
|
|
||||||
if [[ "$iso" == "$STORAGE/"* ]]; then
|
if [[ "$iso" == "$STORAGE/"* ]]; then
|
||||||
@ -312,7 +360,7 @@ extractESD() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
local esdImageCount
|
local esdImageCount
|
||||||
esdImageCount=$(wimlib-imagex info "$iso" | iconv -f UTF-16LE -t UTF-8 | awk '/Image Count:/ {print $3}')
|
esdImageCount=$(wimlib-imagex info "$iso" | awk '/Image Count:/ {print $3}')
|
||||||
|
|
||||||
if [ -z "$esdImageCount" ]; then
|
if [ -z "$esdImageCount" ]; then
|
||||||
error "Cannot read the image count in ESD file!" && return 1
|
error "Cannot read the image count in ESD file!" && return 1
|
||||||
@ -359,7 +407,7 @@ extractESD() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
for (( imageIndex=4; imageIndex<=esdImageCount; imageIndex++ )); do
|
for (( imageIndex=4; imageIndex<=esdImageCount; imageIndex++ )); do
|
||||||
imageEdition=$(wimlib-imagex info "$iso" ${imageIndex} | iconv -f UTF-16LE -t UTF-8 | grep '^Description:' | sed 's/Description:[ \t]*//')
|
imageEdition=$(wimlib-imagex info "$iso" ${imageIndex} | grep '^Description:' | sed 's/Description:[ \t]*//')
|
||||||
[[ "${imageEdition,,}" != "${edition,,}" ]] && continue
|
[[ "${imageEdition,,}" != "${edition,,}" ]] && continue
|
||||||
wimlib-imagex export "$iso" ${imageIndex} "$installWimFile" --compress=LZMS --chunk-size 128K --quiet || {
|
wimlib-imagex export "$iso" ${imageIndex} "$installWimFile" --compress=LZMS --chunk-size 128K --quiet || {
|
||||||
retVal=$?
|
retVal=$?
|
||||||
@ -623,8 +671,7 @@ detectImage() {
|
|||||||
warn "failed to locate 'sources' folder in ISO image, $FB" && return 1
|
warn "failed to locate 'sources' folder in ISO image, $FB" && return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
wim=$(find "$src" -maxdepth 1 -type f -iname install.wim -print -quit)
|
wim=$(find "$src" -maxdepth 1 -type f \( -iname install.wim -or -iname install.esd \) -print -quit)
|
||||||
[ ! -f "$wim" ] && wim=$(find "$src" -maxdepth 1 -type f -iname install.esd -print -quit)
|
|
||||||
|
|
||||||
if [ ! -f "$wim" ]; then
|
if [ ! -f "$wim" ]; then
|
||||||
warn "failed to locate 'install.wim' or 'install.esd' in ISO image, $FB" && return 1
|
warn "failed to locate 'install.wim' or 'install.esd' in ISO image, $FB" && return 1
|
||||||
@ -924,8 +971,7 @@ updateImage() {
|
|||||||
error "failed to locate 'sources' folder in ISO image, $FB" && return 1
|
error "failed to locate 'sources' folder in ISO image, $FB" && return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
wim=$(find "$src" -maxdepth 1 -type f -iname boot.wim -print -quit)
|
wim=$(find "$src" -maxdepth 1 -type f \( -iname boot.wim -or -iname boot.esd \) -print -quit)
|
||||||
[ ! -f "$wim" ] && wim=$(find "$src" -maxdepth 1 -type f -iname boot.esd -print -quit)
|
|
||||||
|
|
||||||
if [ ! -f "$wim" ]; then
|
if [ ! -f "$wim" ]; then
|
||||||
error "failed to locate 'boot.wim' or 'boot.esd' in ISO image, $FB" && return 1
|
error "failed to locate 'boot.wim' or 'boot.esd' in ISO image, $FB" && return 1
|
||||||
|
|||||||
@ -689,7 +689,7 @@ downloadImage() {
|
|||||||
if isESD "$version" "$lang"; then
|
if isESD "$version" "$lang"; then
|
||||||
|
|
||||||
if [[ "$tried" != "n" ]]; then
|
if [[ "$tried" != "n" ]]; then
|
||||||
info "Failed to download $desc, will try a diferent method now..."
|
info "Failed to download $desc, will try a different method now..."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
tried="y"
|
tried="y"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user