mirror of
https://github.com/vdsm/virtual-dsm.git
synced 2025-06-07 08:57:33 +08:00
Compare commits
No commits in common. "32ef7caa85ff815fe32bd50f7db3d0c3d3585b75" and "1a3eacbba7b633ac920a9c4d803a96e3afdb2ae9" have entirely different histories.
32ef7caa85
...
1a3eacbba7
@ -21,6 +21,7 @@ RUN set -eu && extra="" && \
|
|||||||
jq \
|
jq \
|
||||||
tini \
|
tini \
|
||||||
curl \
|
curl \
|
||||||
|
cpio \
|
||||||
wget \
|
wget \
|
||||||
fdisk \
|
fdisk \
|
||||||
unzip \
|
unzip \
|
||||||
@ -57,7 +58,7 @@ COPY --chmod=755 ./web /var/www/
|
|||||||
COPY --chmod=755 --from=builder /qemu-host.bin /run/host.bin
|
COPY --chmod=755 --from=builder /qemu-host.bin /run/host.bin
|
||||||
COPY --chmod=744 ./web/conf/nginx.conf /etc/nginx/sites-enabled/web.conf
|
COPY --chmod=744 ./web/conf/nginx.conf /etc/nginx/sites-enabled/web.conf
|
||||||
|
|
||||||
ADD https://raw.githubusercontent.com/sud0woodo/patology/refs/heads/main/patology.py /run/extract.py
|
ADD https://raw.githubusercontent.com/sud0woodo/patology/refs/heads/main/patology.py /run/patology.py
|
||||||
|
|
||||||
VOLUME /storage
|
VOLUME /storage
|
||||||
EXPOSE 22 139 445 5000
|
EXPOSE 22 139 445 5000
|
||||||
|
@ -12,31 +12,18 @@ else
|
|||||||
BASE="DSM_VirtualDSM_42962"
|
BASE="DSM_VirtualDSM_42962"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
FN="boot.pat"
|
|
||||||
if [ -d "/$FN" ]; then
|
|
||||||
error "The file /$FN has an invalid path!" && exit 65
|
|
||||||
fi
|
|
||||||
|
|
||||||
FILE=$(find / -maxdepth 1 -type f -iname "$FN" | head -n 1)
|
|
||||||
[ ! -s "$FILE" ] && FILE=$(find "$STORAGE" -maxdepth 1 -type f -iname "$FN" | head -n 1)
|
|
||||||
[ -s "$FILE" ] && BASE="DSM_VirtualDSM" && URL="file://$FILE"
|
|
||||||
|
|
||||||
if [ -n "$URL" ]; then
|
if [ -n "$URL" ]; then
|
||||||
if [ ! -s "$FILE" ]; then
|
BASE=$(basename "$URL" .pat)
|
||||||
BASE=$(basename "$URL" .pat)
|
if [ ! -s "$STORAGE/$BASE.system.img" ]; then
|
||||||
if [ ! -s "$STORAGE/$BASE.system.img" ]; then
|
BASE=$(basename "${URL%%\?*}" .pat)
|
||||||
BASE=$(basename "${URL%%\?*}" .pat)
|
: "${BASE//+/ }"; printf -v BASE '%b' "${_//%/\\x}"
|
||||||
: "${BASE//+/ }"; printf -v BASE '%b' "${_//%/\\x}"
|
BASE=$(echo "$BASE" | sed -e 's/[^A-Za-z0-9._-]/_/g')
|
||||||
BASE=$(echo "$BASE" | sed -e 's/[^A-Za-z0-9._-]/_/g')
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
if [[ "${URL,,}" != "http"* ]] && [[ "${URL,,}" != "file:"* ]] ; then
|
if [[ "${URL,,}" != "http"* ]]; then
|
||||||
URL="file://$STORAGE/$BASE.pat"
|
if [ -s "$STORAGE/$BASE.pat" ]; then
|
||||||
if [ ! -s "$STORAGE/$BASE.pat" ]; then
|
URL="file://$STORAGE/$BASE.pat"
|
||||||
URL="file:///$BASE.pat"
|
else
|
||||||
if [ ! -s "/$BASE.pat" ]; then
|
error "File $STORAGE/$BASE.pat does not exist!" && exit 65
|
||||||
error "File '$BASE.pat' does not exist!" && exit 65
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@ -64,11 +51,9 @@ if [ -z "$URL" ]; then
|
|||||||
URL="$DL/release/7.2.2/72806/DSM_VirtualDSM_72806.pat"
|
URL="$DL/release/7.2.2/72806/DSM_VirtualDSM_72806.pat"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -s "$FILE" ]; then
|
BASE=$(basename "${URL%%\?*}" .pat)
|
||||||
BASE=$(basename "${URL%%\?*}" .pat)
|
: "${BASE//+/ }"; printf -v BASE '%b' "${_//%/\\x}"
|
||||||
: "${BASE//+/ }"; printf -v BASE '%b' "${_//%/\\x}"
|
BASE=$(echo "$BASE" | sed -e 's/[^A-Za-z0-9._-]/_/g')
|
||||||
BASE=$(echo "$BASE" | sed -e 's/[^A-Za-z0-9._-]/_/g')
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ "$URL" != "file://$STORAGE/$BASE.pat" ]]; then
|
if [[ "$URL" != "file://$STORAGE/$BASE.pat" ]]; then
|
||||||
rm -f "$STORAGE/$BASE.pat"
|
rm -f "$STORAGE/$BASE.pat"
|
||||||
@ -129,15 +114,10 @@ else
|
|||||||
PROGRESS="--progress=dot:giga"
|
PROGRESS="--progress=dot:giga"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$URL" == "file://"* ]]; then
|
info "Install: Downloading $BASE.pat..."
|
||||||
MSG="Copying DSM"
|
|
||||||
ERR="Failed to copy ${URL:7}"
|
MSG="Downloading DSM"
|
||||||
info "Install: Copying installation image..."
|
ERR="Failed to download $URL"
|
||||||
else
|
|
||||||
MSG="Downloading DSM"
|
|
||||||
ERR="Failed to download $URL"
|
|
||||||
info "Install: Downloading $BASE.pat..."
|
|
||||||
fi
|
|
||||||
|
|
||||||
html "$MSG..."
|
html "$MSG..."
|
||||||
|
|
||||||
@ -146,10 +126,6 @@ rm -f "$PAT"
|
|||||||
|
|
||||||
if [[ "$URL" == "file://"* ]]; then
|
if [[ "$URL" == "file://"* ]]; then
|
||||||
|
|
||||||
if [ ! -f "${URL:7}" ]; then
|
|
||||||
error "File '${URL:7}' does not exist!" && exit 65
|
|
||||||
fi
|
|
||||||
|
|
||||||
cp "${URL:7}" "$PAT"
|
cp "${URL:7}" "$PAT"
|
||||||
|
|
||||||
else
|
else
|
||||||
@ -180,7 +156,7 @@ if ((SIZE<250000000)); then
|
|||||||
error "The specified PAT file is probably an update pack as it's too small." && exit 62
|
error "The specified PAT file is probably an update pack as it's too small." && exit 62
|
||||||
fi
|
fi
|
||||||
|
|
||||||
MSG="Extracting installation image..."
|
MSG="Extracting downloaded image..."
|
||||||
info "Install: $MSG" && html "$MSG"
|
info "Install: $MSG" && html "$MSG"
|
||||||
|
|
||||||
if { tar tf "$PAT"; } >/dev/null 2>&1; then
|
if { tar tf "$PAT"; } >/dev/null 2>&1; then
|
||||||
@ -189,18 +165,16 @@ if { tar tf "$PAT"; } >/dev/null 2>&1; then
|
|||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
{ (cd "$TMP" && python3 /run/extract.py -i "$PAT" -d 2>/run/extract.log); rc=$?; } || :
|
{ (cd "$TMP" && python3 /run/patology.py -i "$PAT" -d >/dev/null); rc=$?; } || :
|
||||||
|
(( rc != 0 )) && error "Failed to extract PAT file, reason $rc" && exit 63
|
||||||
if (( rc != 0 )); then
|
|
||||||
cat /run/extract.log
|
|
||||||
error "Failed to extract PAT file, reason $rc" && exit 63
|
|
||||||
fi
|
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
MSG="Preparing system partition..."
|
MSG="Preparing system partition..."
|
||||||
info "Install: $MSG" && html "$MSG"
|
info "Install: $MSG" && html "$MSG"
|
||||||
|
|
||||||
|
ls -lh $TMP
|
||||||
|
|
||||||
BOOT=$(find "$TMP" -name "*.bin.zip")
|
BOOT=$(find "$TMP" -name "*.bin.zip")
|
||||||
[ ! -s "$BOOT" ] && error "The PAT file contains no boot image." && exit 67
|
[ ! -s "$BOOT" ] && error "The PAT file contains no boot image." && exit 67
|
||||||
|
|
||||||
@ -284,10 +258,22 @@ OFFSET="1048576" # 2048 * 512
|
|||||||
NUMBLOCKS="2097152" # (16777216 * 512) / 4096
|
NUMBLOCKS="2097152" # (16777216 * 512) / 4096
|
||||||
MSG="Installing system partition..."
|
MSG="Installing system partition..."
|
||||||
|
|
||||||
fakeroot -- bash -c "set -Eeu;\
|
if [[ "$ROOT" != [Nn]* ]]; then
|
||||||
tar xpfJ $HDA.txz --absolute-names --skip-old-files -C $MOUNT/;\
|
|
||||||
printf '%b%s%b' '\E[1;34m❯ \E[1;36m' 'Install: $MSG' '\E[0m\n';\
|
tar xpfJ "$HDA.txz" --absolute-names --skip-old-files -C "$MOUNT/"
|
||||||
mke2fs -q -t ext4 -b 4096 -d $MOUNT/ -L $LABEL -F -E offset=$OFFSET $SYSTEM $NUMBLOCKS"
|
|
||||||
|
info "Install: $MSG" && html "$MSG"
|
||||||
|
|
||||||
|
mke2fs -q -t ext4 -b 4096 -d "$MOUNT/" -L "$LABEL" -F -E "offset=$OFFSET" "$SYSTEM" "$NUMBLOCKS"
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
fakeroot -- bash -c "set -Eeu;\
|
||||||
|
tar xpfJ $HDA.txz --absolute-names --skip-old-files -C $MOUNT/;\
|
||||||
|
printf '%b%s%b' '\E[1;34m❯ \E[1;36m' 'Install: $MSG' '\E[0m\n';\
|
||||||
|
mke2fs -q -t ext4 -b 4096 -d $MOUNT/ -L $LABEL -F -E offset=$OFFSET $SYSTEM $NUMBLOCKS"
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
rm -rf "$MOUNT"
|
rm -rf "$MOUNT"
|
||||||
echo "$BASE" > "$STORAGE/dsm.ver"
|
echo "$BASE" > "$STORAGE/dsm.ver"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user