mirror of
https://github.com/vdsm/virtual-dsm.git
synced 2025-07-05 15:05:16 +08:00
Show package installs
Show package installs
This commit is contained in:
commit
7c180740b7
@ -3,13 +3,6 @@ set -u
|
|||||||
|
|
||||||
# Functions
|
# Functions
|
||||||
|
|
||||||
snore()
|
|
||||||
{
|
|
||||||
local IFS
|
|
||||||
[[ -n "${_snore_fd:-}" ]] || exec {_snore_fd}<> <(:)
|
|
||||||
read ${1:+-t "$1"} -u $_snore_fd || :
|
|
||||||
}
|
|
||||||
|
|
||||||
function checkNMI {
|
function checkNMI {
|
||||||
|
|
||||||
local nmi
|
local nmi
|
||||||
@ -28,7 +21,7 @@ function checkNMI {
|
|||||||
|
|
||||||
finish() {
|
finish() {
|
||||||
|
|
||||||
echo "Shutting down agent.." > /dev/ttyS0
|
echo "Shutting down Guest Agent.." > /dev/ttyS0
|
||||||
exit
|
exit
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -54,12 +47,12 @@ if [ "$first_run" = true ]; then
|
|||||||
for filename in /usr/local/packages/*.spk; do
|
for filename in /usr/local/packages/*.spk; do
|
||||||
if [ -f "$filename" ]; then
|
if [ -f "$filename" ]; then
|
||||||
|
|
||||||
/usr/syno/bin/synopkg install "$filename" > /dev/null
|
/usr/syno/bin/synopkg install "$filename" > /dev/ttyS0
|
||||||
|
|
||||||
BASE=$(basename "$filename" .spk)
|
BASE=$(basename "$filename" .spk)
|
||||||
BASE="${BASE%%-*}"
|
BASE="${BASE%%-*}"
|
||||||
|
|
||||||
/usr/syno/bin/synopkg start "$BASE" > /dev/null
|
/usr/syno/bin/synopkg start "$BASE" > /dev/ttyS0
|
||||||
|
|
||||||
rm "$filename"
|
rm "$filename"
|
||||||
|
|
||||||
@ -77,11 +70,13 @@ echo "-------------------------------------------" > /dev/ttyS0
|
|||||||
echo " You can now login to DSM at port 5000 " > /dev/ttyS0
|
echo " You can now login to DSM at port 5000 " > /dev/ttyS0
|
||||||
echo "-------------------------------------------" > /dev/ttyS0
|
echo "-------------------------------------------" > /dev/ttyS0
|
||||||
|
|
||||||
|
# TODO: Auto-update agent
|
||||||
|
|
||||||
# Wait for NMI interrupt as a shutdown signal
|
# Wait for NMI interrupt as a shutdown signal
|
||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
|
|
||||||
checkNMI
|
checkNMI
|
||||||
snore 2
|
sleep 2
|
||||||
|
|
||||||
done
|
done
|
||||||
|
@ -19,13 +19,6 @@ _trap(){
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
snore()
|
|
||||||
{
|
|
||||||
local IFS
|
|
||||||
[[ -n "${_snore_fd:-}" ]] || exec {_snore_fd}<> <(:)
|
|
||||||
read ${1:+-t "$1"} -u $_snore_fd || :
|
|
||||||
}
|
|
||||||
|
|
||||||
_graceful_shutdown(){
|
_graceful_shutdown(){
|
||||||
|
|
||||||
local QEMU_MONPORT="${QEMU_MONPORT:-7100}"
|
local QEMU_MONPORT="${QEMU_MONPORT:-7100}"
|
||||||
@ -42,7 +35,7 @@ _graceful_shutdown(){
|
|||||||
# echo 'system_powerdown' | nc -q 1 -w 1 localhost "${QEMU_MONPORT}">/dev/null
|
# echo 'system_powerdown' | nc -q 1 -w 1 localhost "${QEMU_MONPORT}">/dev/null
|
||||||
|
|
||||||
# Send shutdown command to guest agent tools instead via serial port
|
# Send shutdown command to guest agent tools instead via serial port
|
||||||
RESPONSE=$(curl -s -m 2 -S http://127.0.0.1:2210/write?command=6 2>&1)
|
RESPONSE=$(curl -s -m 2 -S http://127.0.0.1:2210/write?command=6)
|
||||||
|
|
||||||
if [[ ! "${RESPONSE}" =~ "\"success\"" ]] ; then
|
if [[ ! "${RESPONSE}" =~ "\"success\"" ]] ; then
|
||||||
|
|
||||||
|
@ -54,5 +54,5 @@ set +m
|
|||||||
|
|
||||||
# Since we started the QEMU process with -m, we need to poll if it's still running
|
# Since we started the QEMU process with -m, we need to poll if it's still running
|
||||||
while [ -d "/proc/$(cat ${_QEMU_PID})" ]; do
|
while [ -d "/proc/$(cat ${_QEMU_PID})" ]; do
|
||||||
snore 1
|
sleep 1
|
||||||
done
|
done
|
||||||
|
Loading…
x
Reference in New Issue
Block a user