Compare commits

..

22 Commits
v4.21 ... v4.25

Author SHA1 Message Date
Kroese
413a089e02 build: Shellcheck
build: Shellcheck
2023-11-09 01:12:17 +01:00
Kroese
01e23f22fb build: Shellcheck 2023-11-09 01:12:01 +01:00
Kroese
308a764bb0 fix: Prepare agent for removal
fix: Prepare for removal
2023-11-09 01:09:55 +01:00
Kroese
5ad5f8a8ef fix: Prepare for removal 2023-11-09 01:08:46 +01:00
Kroese
3c342a05aa Remove agent
Remove agent
2023-11-08 12:19:18 +01:00
Kroese
d793921bcf fix: Print to stderr 2023-11-08 12:07:38 +01:00
Kroese
5365a9ed4e fix: Do not send NMI 2023-11-08 04:32:50 +01:00
Kroese
7a55c650d0 fix: Do not install agent 2023-11-08 04:26:00 +01:00
Kroese
ede42b3647 fix: Do not install agent 2023-11-08 04:22:08 +01:00
Kroese
8e41b4e567 fix: Increase sleep 2023-11-08 04:21:07 +01:00
Kroese
899687d3f2 fix: Retry if needed 2023-11-08 04:12:09 +01:00
Kroese
2d97bc1cef feat: Retrieve IP address 2023-11-08 03:44:12 +01:00
Kroese
538d7f0195 fix: Display stderr output 2023-11-08 03:36:13 +01:00
Kroese
dcf95a8591 feat: Display info message 2023-11-08 03:31:19 +01:00
Kroese
7f7272b7c8 feat: Update to DSM 7.2.1
feat: Update to DSM 7.2.1
2023-11-01 01:43:18 +01:00
Kroese
c30248f93e docs: Version 2023-11-01 01:40:34 +01:00
Kroese
cf90c9da1f feat: Update to DSM 7.2.1 (69057) 2023-11-01 01:06:41 +01:00
Kroese
461b5598a9 feat: Passthrough multiple devices
feat: Passthrough multiple devices
2023-10-31 16:58:30 +01:00
Kroese
47ed2e8bac build: Changelog 2023-10-31 16:57:43 +01:00
Kroese
1c78e3c8b1 feat: Passthrough multiple devices 2023-10-31 16:53:44 +01:00
Kroese
9f17dfa949 Update Dockerhub description
Update Dockerhub description
2023-10-26 00:56:46 +02:00
Kroese
3de29b6c00 Update Dockerhub description 2023-10-26 00:56:02 +02:00
11 changed files with 109 additions and 93 deletions

View File

@@ -44,8 +44,8 @@ jobs:
TAGS=()
TAGS=("${{ github.repository }}:latest")
TAGS+=("${{ github.repository }}:${VERSION}")
TAGS+=("${{ secrets.DOCKERHUB_MIRROR }}:latest")
TAGS+=("${{ secrets.DOCKERHUB_MIRROR }}:${VERSION}")
#TAGS+=("${{ secrets.DOCKERHUB_MIRROR }}:latest")
#TAGS+=("${{ secrets.DOCKERHUB_MIRROR }}:${VERSION}")
TAGS+=("ghcr.io/${{ github.repository }}:latest")
TAGS+=("ghcr.io/${{ github.repository }}:${VERSION}")
@@ -88,25 +88,6 @@ jobs:
name: Clear Docker credentials
run: |
rm -f ${HOME}/.docker/config.json
-
name: Get previous tag
id: previousTag
run: |
name=$(git --no-pager tag --sort=creatordate --merged ${{ github.ref_name }} | tail -1)
echo "previousTag: $name"
echo "previousTag=$name" >> $GITHUB_ENV
-
name: Generate changelog
id: changelog
uses: requarks/changelog-action@v1
with:
token: ${{ github.token }}
fromTag: ${{ github.ref_name }}
toTag: ${{ env.previousTag }}
writeToFile: false
reverseOrder: true
includeInvalidCommits: true
excludeTypes: "docs,build,chore"
-
name: Create a release
uses: action-pack/github-release@v2
@@ -115,10 +96,6 @@ jobs:
with:
tag: "v${{ steps.prepare.outputs.version }}"
title: "v${{ steps.prepare.outputs.version }}"
body: |
${{ steps.changelog.outputs.changes }}
**Full Changelog**: https://github.com/${{ github.repository }}/compare//${{ env.previousTag }}...v${{ steps.prepare.outputs.version }}
-
name: Increment version variable
uses: action-pack/bump@v2

View File

@@ -11,4 +11,4 @@ jobs:
- name: Run ShellCheck
uses: ludeeus/action-shellcheck@master
env:
SHELLCHECK_OPTS: -x -e SC2001 -e SC2002 -e SC2223 -e SC2034 -e SC2064 -e SC2317 -e SC2028 -e SC2153
SHELLCHECK_OPTS: -x -e SC2001 -e SC2002 -e SC2223 -e SC2034 -e SC2064 -e SC2317 -e SC2028 -e SC2153 -e SC2004

View File

@@ -19,15 +19,6 @@ jobs:
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
repository: ${{ github.repository }}
short-description: ${{ github.event.repository.description }}
readme-filepath: ./readme.md
-
name: Docker Hub Description
uses: peter-evans/dockerhub-description@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
repository: ${{ secrets.DOCKERHUB_MIRROR }}
repository: ${{ secrets.DOCKERHUB_REPO }}
short-description: ${{ github.event.repository.description }}
readme-filepath: ./readme.md

View File

@@ -34,8 +34,6 @@ RUN apt-get update && apt-get -y upgrade && \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
COPY run/*.sh /run/
COPY agent/*.sh /agent/
COPY --from=builder /qemu-host.bin /run/host.bin
RUN chmod +x /run/*.sh && chmod +x /run/*.bin

View File

@@ -1,7 +1,7 @@
#!/usr/bin/env bash
set -u
VERSION="8"
VERSION="9"
HEADER="VirtualDSM Agent"
# Functions
@@ -45,8 +45,12 @@ function downloadUpdate {
[[ "$remote_size" == "" || "$remote_size" == "0" ]] && return
remote_size=$(($remote_size+0))
((remote_size<100)) && return
SCRIPT=$(readlink -f "${BASH_SOURCE[0]}")
local_size=$(stat -c%s "$SCRIPT")
local_size=$(($local_size+0))
[[ remote_size -eq local_size ]] && return
@@ -126,31 +130,6 @@ else
fi
delay=500
elapsed=$((($(date +%s%N) - ts)/1000000))
if [[ delay -gt elapsed ]]; then
difference=$((delay-elapsed))
float=$(echo | awk -v diff="${difference}" '{print diff * 0.001}')
sleep "$float"
fi
# Display message in docker log output
IP=$(ip address show dev eth0 | grep inet | awk '/inet / { print $2 }' | cut -f1 -d/)
if [[ "$IP" == "20.20"* ]]; then
MSG="port 5000"
else
MSG="http://${IP}:5000"
fi
echo ""
info "--------------------------------------------------------"
info " You can now login to DSM at ${MSG}"
info "--------------------------------------------------------"
echo ""
# Wait for NMI interrupt as a shutdown signal
while true; do

View File

@@ -62,7 +62,7 @@ docker run -it --rm -p 5000:5000 --device=/dev/kvm --cap-add NET_ADMIN --stop-ti
DISK_SIZE: "256G"
```
This can also be used to resize the existing disk to a larger capacity without data loss.
This can also be used to resize the existing disk to a larger capacity without any data loss.
* ### How do I change the location of the virtual disk?
@@ -162,18 +162,18 @@ docker run -it --rm -p 5000:5000 --device=/dev/kvm --cap-add NET_ADMIN --stop-ti
* ### How do I install a specific version of vDSM?
By default, version 7.2 will be installed, but if you prefer an older version, you can add its URL to your compose file as follows:
By default, version 7.2.1 will be installed, but if you prefer an older version, you can add its download URL to your compose file as follows:
```yaml
environment:
URL: "https://global.synologydownload.com/download/DSM/release/7.0.1/42218/DSM_VirtualDSM_42218.pat"
```
With this method, you are able to switch between different versions while keeping your file data.
With this method, it is even possible to switch between different versions while keeping all your file data intact.
* ### How do I passthrough my GPU?
To passthrough your GPU, add the following lines to your compose file:
To passthrough your Intel GPU, add the following lines to your compose file:
```yaml
environment:
@@ -182,11 +182,11 @@ docker run -it --rm -p 5000:5000 --device=/dev/kvm --cap-add NET_ADMIN --stop-ti
- /dev/dri
```
This can be used to enable facial recognition in Synology Photos for example.
This can be used to enable the facial recognition function in Synology Photos for example.
* ### What are the differences compared to the standard DSM?
There are only two minor differences: the Virtual Machine Manager package is not provided, and Surveillance Station doesn't include any free licenses.
There are only two minor differences: the Virtual Machine Manager package is not available, and Surveillance Station will not include any free licenses.
* ### Is this project legal?

View File

@@ -178,6 +178,8 @@ else
fi
: ${DEVICE:=''} # Docker variable to passthrough a block device, like /dev/vdc1.
: ${DEVICE2:=''}
: ${DEVICE3:=''}
if [ -n "${DEVICE}" ]; then
@@ -189,3 +191,25 @@ if [ -n "${DEVICE}" ]; then
-device scsi-hd,bus=hw-userdata4.0,channel=0,scsi-id=0,lun=0,drive=drive-userdata4,id=userdata4,rotation_rate=${DISK_ROTATION},bootindex=6"
fi
if [ -n "${DEVICE2}" ]; then
[ ! -b "${DEVICE2}" ] && error "Device ${DEVICE2} cannot be found! Please add it to the 'devices' section of your compose file." && exit 56
DISK_OPTS="${DISK_OPTS} \
-device virtio-scsi-pci,id=hw-userdata5,bus=pcie.0,addr=0x5 \
-drive file=${DEVICE2},if=none,id=drive-userdata5,format=raw,cache=${DISK_CACHE},aio=${DISK_IO},discard=${DISK_DISCARD},detect-zeroes=on \
-device scsi-hd,bus=hw-userdata5.0,channel=0,scsi-id=0,lun=0,drive=drive-userdata5,id=userdata5,rotation_rate=${DISK_ROTATION},bootindex=7"
fi
if [ -n "${DEVICE3}" ]; then
[ ! -b "${DEVICE3}" ] && error "Device ${DEVICE3} cannot be found! Please add it to the 'devices' section of your compose file." && exit 57
DISK_OPTS="${DISK_OPTS} \
-device virtio-scsi-pci,id=hw-userdata6,bus=pcie.0,addr=0x6 \
-drive file=${DEVICE3},if=none,id=drive-userdata6,format=raw,cache=${DISK_CACHE},aio=${DISK_IO},discard=${DISK_DISCARD},detect-zeroes=on \
-device scsi-hd,bus=hw-userdata6.0,channel=0,scsi-id=0,lun=0,drive=drive-userdata6,id=userdata6,rotation_rate=${DISK_ROTATION},bootindex=8"
fi

View File

@@ -10,7 +10,7 @@ DL="https://global.synologydownload.com/download/DSM"
if [ -z "$URL" ]; then
if [ "$ARCH" == "amd64" ]; then
URL="$DL/release/7.2/64570-1/DSM_VirtualDSM_64570.pat"
URL="$DL/release/7.2.1/69057-1/DSM_VirtualDSM_69057.pat"
else
URL="$DL/release/7.0.1/42218/DSM_VirtualDSM_42218.pat"
fi
@@ -230,18 +230,6 @@ rm -f "$MOUNT/.SynoUpgradePackages/ActiveInsight-"*
[ -f "$HDP.txz" ] && tar xpfJ "$HDP.txz" --absolute-names -C "$MOUNT/"
[ -f "$IDB.txz" ] && tar xpfJ "$IDB.txz" --absolute-names -C "$MOUNT/usr/syno/synoman/indexdb/"
# Install Agent
LOC="$MOUNT/usr/local/bin"
mkdir -p "$LOC"
cp /agent/agent.sh "$LOC/agent.sh"
chmod 755 "$LOC/agent.sh"
LOC="$MOUNT/usr/local/etc/rc.d"
mkdir -p "$LOC"
cp /agent/service.sh "$LOC/agent.sh"
chmod 755 "$LOC/agent.sh"
info "Install: Installing system partition..."
LABEL="1.44.1-42218"

View File

@@ -39,13 +39,8 @@ _graceful_shutdown() {
echo && error "Could not send shutdown command to the guest ($RESPONSE)"
# Send a NMI interrupt which will be detected by the agent script
if ! echo 'nmi' | nc -q 1 -w 1 localhost "${QEMU_MONPORT}" > /dev/null ; then
kill -15 "$(cat "${_QEMU_PID}")"
pkill -f qemu-system-x86_64 || true
fi
kill -15 "$(cat "${_QEMU_PID}")"
pkill -f qemu-system-x86_64 || true
fi
@@ -58,8 +53,9 @@ _graceful_shutdown() {
if echo 'info version'| nc -q 1 -w 1 localhost "${QEMU_MONPORT}" >/dev/null 2>&1 ; then
sleep 1
CNT="$(cat ${_QEMU_SHUTDOWN_COUNTER})/${QEMU_POWERDOWN_TIMEOUT}"
[[ "${DEBUG}" == [Yy1]* ]] && info "Shutting down, waiting... (${CNT})"
#CNT="$(cat ${_QEMU_SHUTDOWN_COUNTER})/${QEMU_POWERDOWN_TIMEOUT}"
#[[ "${DEBUG}" == [Yy1]* ]] && info "Shutting down, waiting... (${CNT})"
fi

63
run/print.sh Normal file
View File

@@ -0,0 +1,63 @@
#!/usr/bin/env bash
set -Eeuo pipefail
info () { echo -e >&2 "\E[1;34m\E[1;36m $1\E[0m" ; }
error () { echo -e >&2 "\E[1;31m ERROR: $1\E[0m" ; }
retry=true
while [ "$retry" = true ]
do
sleep 2
# Retrieve IP from guest VM
set +e
RESPONSE=$(curl -s -m 16 -S http://127.0.0.1:2210/read?command=10 2>&1)
set -e
if [[ ! "${RESPONSE}" =~ "\"success\"" ]] ; then
error "Failed to connect to guest: $RESPONSE" && continue
fi
# Retrieve the HTTP port number
if [[ ! "${RESPONSE}" =~ "\"http_port\"" ]] ; then
error "Failed to parse response from guest: $RESPONSE" && continue
fi
rest=${RESPONSE#*http_port}
rest=${rest#*:}
rest=${rest%%,*}
PORT=${rest%%\"*}
[ -z "${PORT}" ] && continue
# Retrieve the IP address
if [[ ! "${RESPONSE}" =~ "eth0" ]] ; then
error "Failed to parse response from guest: $RESPONSE" && continue
fi
rest=${RESPONSE#*eth0}
rest=${rest#*ip}
rest=${rest#*:}
rest=${rest#*\"}
IP=${rest%%\"*}
[ -z "${IP}" ] && continue
retry=false
done
if [[ "$IP" == "20.20"* ]]; then
MSG="port ${PORT}"
else
MSG="http://${IP}:${PORT}"
fi
echo "" >&2
info "--------------------------------------------------------"
info " You can now login to DSM at ${MSG}"
info "--------------------------------------------------------"
echo "" >&2

View File

@@ -45,7 +45,7 @@ if [[ "${HOST_DEBUG}" == [Yy1]* ]]; then
{ set +x; } 2>/dev/null
echo
else
./run/host.bin "${HOST_ARGS[@]}" 2> /dev/null &
./run/host.bin "${HOST_ARGS[@]}" >/dev/null &
fi
# Configure serial ports