mirror of
https://github.com/dockur/windows.git
synced 2026-07-15 01:38:16 +01:00
feat: Use state helper for base image reads (#1839)
This commit is contained in:
+4
-15
@@ -11,17 +11,11 @@ backup () {
|
|||||||
local iso="$1"
|
local iso="$1"
|
||||||
local name="unknown"
|
local name="unknown"
|
||||||
local root="$STORAGE/backups"
|
local root="$STORAGE/backups"
|
||||||
local previous="$STORAGE/windows.base"
|
local previous
|
||||||
|
|
||||||
if [ -f "$previous" ]; then
|
|
||||||
|
|
||||||
previous=$(<"$previous")
|
|
||||||
previous="${previous//[![:print:]]/}"
|
|
||||||
|
|
||||||
|
previous=$(readState "base") || return 1
|
||||||
[ -n "$previous" ] && name="${previous%.*}"
|
[ -n "$previous" ] && name="${previous%.*}"
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! makeDir "$root"; then
|
if ! makeDir "$root"; then
|
||||||
error "Failed to create directory \"$root\" !"
|
error "Failed to create directory \"$root\" !"
|
||||||
return 1
|
return 1
|
||||||
@@ -59,12 +53,9 @@ skipInstall() {
|
|||||||
local method=""
|
local method=""
|
||||||
local magic byte
|
local magic byte
|
||||||
local boot="$STORAGE/windows.boot"
|
local boot="$STORAGE/windows.boot"
|
||||||
local previous="$STORAGE/windows.base"
|
local previous
|
||||||
|
|
||||||
if [ -f "$previous" ]; then
|
previous=$(readState "base") || return 1
|
||||||
|
|
||||||
previous=$(<"$previous")
|
|
||||||
previous="${previous//[![:print:]]/}"
|
|
||||||
|
|
||||||
if [ -n "$previous" ]; then
|
if [ -n "$previous" ]; then
|
||||||
if [[ "${STORAGE,,}/${previous,,}" != "${iso,,}" ]]; then
|
if [[ "${STORAGE,,}/${previous,,}" != "${iso,,}" ]]; then
|
||||||
@@ -100,8 +91,6 @@ skipInstall() {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
[ -f "$boot" ] && hasDisk && return 0
|
[ -f "$boot" ] && hasDisk && return 0
|
||||||
|
|
||||||
[ ! -f "$iso" ] && return 1
|
[ ! -f "$iso" ] && return 1
|
||||||
|
|||||||
Reference in New Issue
Block a user