Compare commits

...

12 Commits

Author SHA1 Message Date
Kroese 7c16919322
Update define.sh 2024-05-05 17:01:44 +02:00
Kroese 99ba0edf79
Update install.sh 2024-05-05 16:57:10 +02:00
Kroese 5af74a709c
Update power.sh 2024-05-05 16:41:26 +02:00
Kroese 180589858e
Update define.sh 2024-05-05 15:22:39 +02:00
Kroese 3ac9c9a4d5
Update install.sh 2024-05-05 13:06:11 +02:00
Kroese 31417a71a1
Update install.sh 2024-05-05 13:00:18 +02:00
Kroese 6925567619
Update install.sh 2024-05-05 12:39:49 +02:00
Kroese f81d3b2e31
Update install.sh 2024-05-05 12:27:48 +02:00
Kroese a37013ffe3
Update install.sh 2024-05-05 12:01:46 +02:00
Kroese 3913b789bb
Update install.sh 2024-05-05 11:48:40 +02:00
Kroese 48807ea887
Update install.sh 2024-05-05 11:37:01 +02:00
Kroese fbdb171f79
Update samba.sh 2024-05-05 09:13:15 +02:00
4 changed files with 88 additions and 69 deletions

View File

@ -3,6 +3,7 @@ set -Eeuo pipefail
: "${VERIFY:=""}"
: "${MANUAL:=""}"
: "${REMOVE:=""}"
: "${VERSION:=""}"
: "${DETECTED:=""}"
: "${PLATFORM:="x64"}"

View File

@ -51,24 +51,13 @@ startInstall() {
fi
[[ "${file,,}" == "windows."* ]] && file="win.iso"
ISO="$STORAGE/$file.iso"
ISO="$STORAGE/$file"
fi
if [[ "${PLATFORM,,}" == "x64" ]]; then
! migrateFiles "$ISO" "$VERSION" && error "Migration failed!" && exit 57
fi
if skipInstall; then
if [ ! -f "$ISO" ] || [ ! -s "$ISO" ]; then
ISO="/custom.iso"
[ ! -f "$ISO" ] && ISO="${STORAGE}$ISO"
fi
[[ "${PLATFORM,,}" == "arm64" ]] && VGA="virtio-gpu"
return 1
fi
skipInstall && return 1
if [ -f "$ISO" ] && [ -s "$ISO" ]; then
@ -76,40 +65,34 @@ startInstall() {
local magic=""
magic=$(dd if="$ISO" seek=0 bs=1 count=1 status=none | tr -d '\000')
magic="$(printf '%s' "$magic" | od -A n -t x1 -v | tr -d ' \n')"
[[ "$magic" == "16" ]] && return 1
if [[ "$magic" == "16" ]]; then
hasDisk && return 1
[[ "$MANUAL" == [Yy1]* ]] && [ -z "$CUSTOM" ] && return 1
fi
if [ -z "$CUSTOM" ]; then
rm -f "$ISO"
else
if [ -n "$ORIGINAL" ]; then
rm -f "$ISO"
ISO="$ORIGINAL"
CUSTOM="$ISO"
fi
if [ -n "$CUSTOM" ] && [ -n "$CUSTOM_ORG" ]; then
if [[ "$CUSTOM" != "$CUSTOM_ORG" ]]; then
rm -f "$CUSTOM"
ISO="$CUSTOM_ORG"
fi
fi
CUSTOM="$ISO"
fi
rm -rf "$TMP"
mkdir -p "$TMP"
if [ -f "$CUSTOM" ]; then
if [ -n "$CUSTOM" ]; then
local size
size="$(stat -c%s "$ISO")"
BOOT="$STORAGE/windows.$size.iso"
else
CUSTOM=""
BOOT="$ISO"
ISO=$(basename "$ISO")
BOOT="$STORAGE/$ISO"
ISO="$TMP/$ISO"
fi
[[ "$BOOT" == "$ISO" ]] && return 1
rm -f "$BOOT"
return 0
}
@ -160,14 +143,20 @@ abortInstall() {
local iso="$1"
if [[ "$iso" != "$BOOT" ]]; then
if ! mv -f "$iso" "$BOOT"; then
error "Failed to move ISO file: $iso" && return 1
[[ "${iso,,}" == *".esd" ]] && exit 60
if [ -n "$CUSTOM" ]; then
BOOT="$iso"
REMOVE="N"
else
if [[ "$iso" != "$BOOT" ]]; then
if ! mv -f "$iso" "$BOOT"; then
error "Failed to move ISO file: $iso" && return 1
fi
fi
fi
finishInstall "$BOOT" "Y" && return 0
return 1
}
@ -177,13 +166,12 @@ detectCustom() {
local size base
CUSTOM=""
CUSTOM_ORG=""
ORIGINAL=""
if [[ "${VERSION,,}" != "http"* ]]; then
base="${VERSION/\/storage\//}"
[[ "$base" == "."* ]] && base="${file:1}"
[[ "$base" == *"/"* ]] && base=""
[[ "$base" == "windows."* ]] && base=""
[ -n "$base" ] && file=$(find "$STORAGE" -maxdepth 1 -type f -iname "$base" -printf "%f\n" | head -n 1)
fi
@ -201,12 +189,17 @@ detectCustom() {
size="$(stat -c%s "$file")"
[ -z "$size" ] || [[ "$size" == "0" ]] && return 0
CUSTOM_ORG="$file"
base="$STORAGE/windows.$size.iso"
[ -f "$base" ] && [ -s "$base" ] && file="$base"
CUSTOM="$file"
if [ -f "$base" ] && [ -s "$base" ]; then
CUSTOM="$base"
ORIGINAL="$file"
else
REMOVE="N"
CUSTOM="$file"
rm -f "$base"
fi
return 0
}
@ -339,7 +332,7 @@ verifyFile() {
fi
if [[ "$hash" == "$check" ]]; then
info "Succesfully verified that the checksum was correct!" && return 0
info "Succesfully verified ISO!" && return 0
fi
error "Invalid $algo checksum: $hash , but expected value is: $check ! Please report this at $SUPPORT/issues"
@ -403,10 +396,11 @@ downloadImage() {
local iso="$1"
local version="$2"
local tried="n"
local url sum size desc
local url sum size base desc
if [[ "${version,,}" == "http"* ]]; then
desc=$(fromFile "$BASE")
base=$(basename "$iso")
desc=$(fromFile "$base")
downloadFile "$iso" "$version" "" "" "$desc" && return 0
return 1
fi
@ -433,9 +427,10 @@ downloadImage() {
tried="y"
if getESD "$TMP/esd" "$version"; then
ISO="$TMP/$version.esd"
local prev="$ISO"
ISO="${ISO%.*}.esd"
downloadFile "$ISO" "$ESD" "$ESD_SUM" "$ESD_SIZE" "$desc" && return 0
ISO="$TMP/$BASE"
ISO="$prev"
fi
fi
@ -459,6 +454,17 @@ downloadImage() {
return 1
}
removeDownload() {
local iso="$1"
[ ! -f "$iso" ] && return 0
[ -n "$CUSTOM" ] && return 0
! rm -f "$iso" 2> /dev/null && warn "failed to remove $iso !"
return 0
}
extractESD() {
local iso="$1"
@ -737,7 +743,7 @@ detectImage() {
local fallback="/run/assets/${DETECTED%%-*}.xml"
setXML "$fallback" && warn "${msg}." && return 0
warn "${msg}, $FB."
return 0
}
@ -778,9 +784,8 @@ prepareImage() {
updateImage() {
local iso="$1"
local dir="$2"
local asset="$3"
local dir="$1"
local asset="$2"
local path src loc xml index result
[ ! -s "$asset" ] || [ ! -f "$asset" ] && return 0
@ -856,9 +861,14 @@ buildImage() {
local failed="N"
local cat="BOOT.CAT"
local log="/run/shm/iso.log"
local size size_gb space space_gb desc
local out="$TMP/${BASE%.*}.tmp"
local base size size_gb space space_gb desc
if [ -f "$BOOT" ]; then
error "File $BOOT does already exist?!" && return 1
fi
base=$(basename "$BOOT")
local out="$TMP/${base%.*}.tmp"
rm -f "$out"
desc=$(printVersion "$DETECTED" "ISO")
@ -914,19 +924,23 @@ buildImage() {
[ -s "$log" ] && error="$(<"$log")"
[[ "$error" != "$hide" ]] && echo "$error"
if [ -f "$BOOT" ]; then
error "File $BOOT does already exist?!" && return 1
fi
mv "$out" "$BOOT"
return 0
}
bootWindows() {
BOOT="$ISO"
rm -rf "$TMP"
if [ ! -f "$ISO" ] || [ ! -s "$ISO" ]; then
ISO="/custom.iso"
[ ! -f "$ISO" ] && ISO="${STORAGE}$ISO"
fi
BOOT="$ISO"
[[ "${PLATFORM,,}" == "arm64" ]] && VGA="virtio-gpu"
if [ -s "$STORAGE/windows.mode" ] && [ -f "$STORAGE/windows.mode" ]; then
BOOT_MODE=$(<"$STORAGE/windows.mode")
if [ -s "$STORAGE/windows.old" ] && [ -f "$STORAGE/windows.old" ]; then
@ -1004,11 +1018,15 @@ if ! prepareImage "$ISO" "$DIR"; then
exit 60
fi
if ! updateImage "$ISO" "$DIR" "$XML"; then
if ! updateImage "$DIR" "$XML"; then
abortInstall "$ISO" && return 0
exit 60
fi
if ! removeDownload "$ISO"; then
exit 64
fi
if ! copyOEM "$DIR"; then
exit 63
fi

View File

@ -81,12 +81,11 @@ finish() {
done
fi
if [ ! -f "$STORAGE/windows.boot" ] && [ -f "$STORAGE/$BASE" ]; then
if [ ! -f "$STORAGE/windows.boot" ] && [ -f "$BOOT" ]; then
# Remove CD-ROM ISO after install
if ready; then
if rm -f "$STORAGE/$BASE" 2>/dev/null; then
touch "$STORAGE/windows.boot"
fi
if ready && [[ "$REMOVE" != [Nn]* ]]; then
rm -f "$BOOT" 2>/dev/null || true
touch "$STORAGE/windows.boot"
fi
fi

View File

@ -15,9 +15,10 @@ if [[ "$DHCP" == [Yy1]* ]]; then
fi
share="$STORAGE/shared"
[ ! -d "$share" ] && share="/shared"
mkdir -p "$share"
[ -z "$(ls -A "$share")" ] && chmod -R 777 "$share"
[ -z "$(ls -A "$share")" ] && chmod 777 "$share"
{ echo "[global]"
echo " server string = Dockur"
@ -53,16 +54,16 @@ mkdir -p "$share"
echo ""
echo "Using this folder you can share files with the host machine."
echo ""
echo "To change the storage location, include the following bind mount in your compose file:"
echo "To change its location, include the following bind mount in your compose file:"
echo ""
echo " volumes:"
echo " - \"/home/user/example:/storage/shared\""
echo " - \"/home/user/example:/shared\""
echo ""
echo "Or in your run command:"
echo ""
echo " -v \"/home/user/example:/storage/shared\""
echo " -v \"/home/user/example:/shared\""
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 shared folder."
echo ""
} | unix2dos > "$share/readme.txt"