Skip to content

Commit

Permalink
fix: Sanitize filename (#55)
Browse files Browse the repository at this point in the history
  • Loading branch information
kroese authored Jan 19, 2024
1 parent 5137d51 commit 245b3fc
Showing 1 changed file with 11 additions and 18 deletions.
29 changes: 11 additions & 18 deletions src/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,22 @@ fi

MSG="Please wait while Windows is being started..."

if [ ! -f "$STORAGE/custom.iso" ]; then
BASE="custom.iso"
if [ ! -f "$STORAGE/$BASE" ]; then

if [[ "$EXTERNAL" != [Yy1]* ]]; then

if [ ! -f "$STORAGE/$VERSION.iso" ]; then
BASE="$VERSION.iso"
if [ ! -f "$STORAGE/$BASE" ]; then
MSG="Please wait while Windows is being downloaded..."
fi

else

BASE=$(basename "$VERSION")
BASE=$(basename "${VERSION%%\?*}")
: "${BASE//+/ }"; printf -v BASE '%b' "${_//%/\\x}"
BASE=$(echo "$BASE" | sed -e 's/[^A-Za-z0-9._-]/_/g')

if [ ! -f "$STORAGE/$BASE" ]; then
MSG="Please wait while '$BASE' is being downloaded..."
fi
Expand All @@ -68,19 +74,6 @@ fi
# Display wait message
/run/server.sh "Windows" "$MSG" &

BASE="custom.iso"
[ -f "$STORAGE/$BASE" ] && return 0

if [[ "$EXTERNAL" != [Yy1]* ]]; then

BASE="$VERSION.iso"

else

BASE=$(basename "$VERSION")

fi

[ -f "$STORAGE/$BASE" ] && return 0

TMP="$STORAGE/tmp"
Expand Down Expand Up @@ -250,8 +243,6 @@ else
[ -n "$XML" ] && error "Warning: XML file '$XML' does not exist, $FB" && echo
fi

info "Generating new ISO image for installation..."

ETFS="boot/etfsboot.com"
EFISYS="efi/microsoft/boot/efisys_noprompt.bin"

Expand All @@ -264,6 +255,8 @@ if [ -f "$DIR/$ETFS" ]; then
ISO="$TMP/$LABEL.tmp"
rm -f "$ISO"

info "Generating new ISO image for installation..."

genisoimage -b "$ETFS" -no-emul-boot -c "$CAT" -iso-level 4 -J -l -D -N -joliet-long -relaxed-filenames -quiet -V "$LABEL" -udf \
-boot-info-table -eltorito-alt-boot -eltorito-boot "$EFISYS" -no-emul-boot -o "$ISO" -allow-limited-size "$DIR"

Expand Down

0 comments on commit 245b3fc

Please sign in to comment.