feat: Disable S3 and S4 standby modes (#434)
This commit is contained in:
parent
80ae80ae10
commit
3390ef8101
@ -1,5 +1,5 @@
|
|||||||
FROM scratch
|
FROM scratch
|
||||||
COPY --from=qemux/qemu-docker:4.25 / /
|
COPY --from=qemux/qemu-docker:4.26 / /
|
||||||
|
|
||||||
ARG DEBCONF_NOWARNINGS "yes"
|
ARG DEBCONF_NOWARNINGS "yes"
|
||||||
ARG DEBIAN_FRONTEND "noninteractive"
|
ARG DEBIAN_FRONTEND "noninteractive"
|
||||||
|
@ -164,7 +164,7 @@ docker run -it --rm --name windows -p 8006:8006 --device=/dev/kvm --cap-add NET_
|
|||||||
- /home/user/example.iso:/storage/custom.iso
|
- /home/user/example.iso:/storage/custom.iso
|
||||||
```
|
```
|
||||||
|
|
||||||
Replace the example path `/home/user/example.iso` with the filename of the desired ISO file.
|
Replace the example path `/home/user/example.iso` with the filename of the desired ISO file. The value of `VERSION` will be ignored in this case.
|
||||||
|
|
||||||
* ### How do I customize the installation?
|
* ### How do I customize the installation?
|
||||||
|
|
||||||
|
@ -275,20 +275,25 @@ finishInstall() {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
rm -f "$STORAGE/windows.ver"
|
||||||
|
rm -f "$STORAGE/windows.old"
|
||||||
rm -f "$STORAGE/windows.boot"
|
rm -f "$STORAGE/windows.boot"
|
||||||
|
rm -f "$STORAGE/windows.mode"
|
||||||
|
|
||||||
cp /run/version "$STORAGE/windows.ver"
|
cp /run/version "$STORAGE/windows.ver"
|
||||||
|
|
||||||
if [[ "${BOOT_MODE,,}" == "windows_legacy" ]]; then
|
if [[ "${BOOT_MODE,,}" == "windows_legacy" ]]; then
|
||||||
echo "$MACHINE" > "$STORAGE/windows.old"
|
if [[ "${MACHINE,,}" != "q35" ]]; then
|
||||||
|
echo "$MACHINE" > "$STORAGE/windows.old"
|
||||||
|
fi
|
||||||
|
echo "$BOOT_MODE" > "$STORAGE/windows.mode"
|
||||||
else
|
else
|
||||||
rm -f "$STORAGE/windows.old"
|
# Enable secure boot + TPM on manual installs as Win11 requires
|
||||||
fi
|
if [[ "$MANUAL" == [Yy1]* ]] || [[ "$aborted" == [Yy1]* ]]; then
|
||||||
|
if [[ "${DETECTED,,}" == "win11"* ]]; then
|
||||||
# Enable secure boot + TPM on manual installs as Win11 requires
|
BOOT_MODE="windows_secure"
|
||||||
if [[ "$MANUAL" == [Yy1]* ]] || [[ "$aborted" == [Yy1]* ]]; then
|
echo "$BOOT_MODE" > "$STORAGE/windows.mode"
|
||||||
if [[ "${DETECTED,,}" == "win11"* ]]; then
|
fi
|
||||||
BOOT_MODE="windows_secure"
|
|
||||||
echo "$BOOT_MODE" > "$STORAGE/windows.mode"
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -1151,16 +1156,22 @@ buildImage() {
|
|||||||
|
|
||||||
bootWindows() {
|
bootWindows() {
|
||||||
|
|
||||||
if [ -f "$STORAGE/windows.old" ]; then
|
if [ -s "$STORAGE/windows.mode" ] && [ -f "$STORAGE/windows.mode" ]; then
|
||||||
MACHINE=$(<"$STORAGE/windows.old")
|
BOOT_MODE=$(<"$STORAGE/windows.mode")
|
||||||
[ -z "$MACHINE" ] && MACHINE="q35"
|
if [ -s "$STORAGE/windows.old" ] && [ -f "$STORAGE/windows.old" ]; then
|
||||||
BOOT_MODE="windows_legacy"
|
MACHINE=$(<"$STORAGE/windows.old")
|
||||||
|
fi
|
||||||
rm -rf "$TMP"
|
rm -rf "$TMP"
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -s "$STORAGE/windows.mode" ] && [ -f "$STORAGE/windows.mode" ]; then
|
# Migrations
|
||||||
BOOT_MODE=$(<"$STORAGE/windows.mode")
|
|
||||||
|
if [ -f "$STORAGE/windows.old" ]; then
|
||||||
|
MACHINE=$(<"$STORAGE/windows.old")
|
||||||
|
[ -z "$MACHINE" ] && MACHINE="q35"
|
||||||
|
BOOT_MODE="windows_legacy"
|
||||||
|
echo "$BOOT_MODE" > "$STORAGE/windows.mode"
|
||||||
rm -rf "$TMP"
|
rm -rf "$TMP"
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
@ -28,7 +28,7 @@ ready() {
|
|||||||
[ -f "$STORAGE/windows.boot" ] && return 0
|
[ -f "$STORAGE/windows.boot" ] && return 0
|
||||||
[ ! -s "$QEMU_PTY" ] && return 1
|
[ ! -s "$QEMU_PTY" ] && return 1
|
||||||
|
|
||||||
if [ -f "$STORAGE/windows.old" ]; then
|
if [[ "${BOOT_MODE,,}" == "windows_legacy" ]]; then
|
||||||
local last
|
local last
|
||||||
local bios="Booting from Hard"
|
local bios="Booting from Hard"
|
||||||
last=$(grep "^Booting.*" "$QEMU_PTY" | tail -1)
|
last=$(grep "^Booting.*" "$QEMU_PTY" | tail -1)
|
||||||
|
32
src/samba.sh
32
src/samba.sh
@ -3,22 +3,27 @@ set -Eeuo pipefail
|
|||||||
|
|
||||||
: "${SAMBA:="Y"}"
|
: "${SAMBA:="Y"}"
|
||||||
|
|
||||||
[[ "$DHCP" == [Yy1]* ]] && return 0
|
|
||||||
[[ "$SAMBA" != [Yy1]* ]] && return 0
|
[[ "$SAMBA" != [Yy1]* ]] && return 0
|
||||||
[[ "$NETWORK" != [Yy1]* ]] && return 0
|
[[ "$NETWORK" != [Yy1]* ]] && return 0
|
||||||
|
|
||||||
SHARE="$STORAGE/shared"
|
hostname="host.lan"
|
||||||
|
interface="dockerbridge"
|
||||||
|
|
||||||
mkdir -p "$SHARE"
|
if [[ "$DHCP" == [Yy1]* ]]; then
|
||||||
chmod -R 777 "$SHARE"
|
hostname="$IP"
|
||||||
|
interface="$VM_NET_DEV"
|
||||||
|
fi
|
||||||
|
|
||||||
SAMBA="/etc/samba/smb.conf"
|
share="$STORAGE/shared"
|
||||||
|
|
||||||
|
mkdir -p "$share"
|
||||||
|
[ -z "$(ls -A "$share")" ] && chmod -R 777 "$share"
|
||||||
|
|
||||||
{ echo "[global]"
|
{ echo "[global]"
|
||||||
echo " server string = Dockur"
|
echo " server string = Dockur"
|
||||||
echo " netbios name = dockur"
|
echo " netbios name = $hostname"
|
||||||
echo " workgroup = WORKGROUP"
|
echo " workgroup = WORKGROUP"
|
||||||
echo " interfaces = dockerbridge"
|
echo " interfaces = $interface"
|
||||||
echo " bind interfaces only = yes"
|
echo " bind interfaces only = yes"
|
||||||
echo " security = user"
|
echo " security = user"
|
||||||
echo " guest account = nobody"
|
echo " guest account = nobody"
|
||||||
@ -32,14 +37,14 @@ SAMBA="/etc/samba/smb.conf"
|
|||||||
echo " disable spoolss = yes"
|
echo " disable spoolss = yes"
|
||||||
echo ""
|
echo ""
|
||||||
echo "[Data]"
|
echo "[Data]"
|
||||||
echo " path = $SHARE"
|
echo " path = $share"
|
||||||
echo " comment = Shared"
|
echo " comment = Shared"
|
||||||
echo " writable = yes"
|
echo " writable = yes"
|
||||||
echo " guest ok = yes"
|
echo " guest ok = yes"
|
||||||
echo " guest only = yes"
|
echo " guest only = yes"
|
||||||
echo " force user = root"
|
echo " force user = root"
|
||||||
echo " force group = root"
|
echo " force group = root"
|
||||||
} > "$SAMBA"
|
} > "/etc/samba/smb.conf"
|
||||||
|
|
||||||
{ echo "--------------------------------------------------------"
|
{ echo "--------------------------------------------------------"
|
||||||
echo " $APP for Docker v$(</run/version)..."
|
echo " $APP for Docker v$(</run/version)..."
|
||||||
@ -59,7 +64,7 @@ SAMBA="/etc/samba/smb.conf"
|
|||||||
echo ""
|
echo ""
|
||||||
echo "Replace the example path /home/user/example with the desired storage folder."
|
echo "Replace the example path /home/user/example with the desired storage folder."
|
||||||
echo ""
|
echo ""
|
||||||
} | unix2dos > "$SHARE/readme.txt"
|
} | unix2dos > "$share/readme.txt"
|
||||||
|
|
||||||
! smbd && smbd --debug-stdout
|
! smbd && smbd --debug-stdout
|
||||||
|
|
||||||
@ -67,17 +72,16 @@ isXP="N"
|
|||||||
|
|
||||||
if [ -f "$STORAGE/windows.old" ]; then
|
if [ -f "$STORAGE/windows.old" ]; then
|
||||||
MT=$(<"$STORAGE/windows.old")
|
MT=$(<"$STORAGE/windows.old")
|
||||||
if [[ "${MT,,}" == "pc-q35-2"* ]]; then
|
[[ "${MT,,}" == "pc-q35-2"* ]] && isXP="Y"
|
||||||
isXP="Y"
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$isXP" == [Yy1]* ]]; then
|
if [[ "$isXP" == [Yy1]* ]]; then
|
||||||
|
[[ "$DHCP" == [Yy1]* ]] && return 0
|
||||||
# Enable NetBIOS on Windows XP
|
# Enable NetBIOS on Windows XP
|
||||||
! nmbd && nmbd --debug-stdout
|
! nmbd && nmbd --debug-stdout
|
||||||
else
|
else
|
||||||
# Enable Web Service Discovery
|
# Enable Web Service Discovery
|
||||||
wsdd -i dockerbridge -p -n "host.lan" &
|
wsdd -i "$interface" -p -n "$hostname" &
|
||||||
fi
|
fi
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
|
Loading…
Reference in New Issue
Block a user