vm: Split updates check and download into separate scripts (#198)
This commit is contained in:
parent
ac61edf880
commit
382dafb6cd
20
common/qubes_check_for_updates.sh
Executable file
20
common/qubes_check_for_updates.sh
Executable file
@ -0,0 +1,20 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
DOM0_UPDATES_DIR=/var/lib/qubes/dom0-updates
|
||||||
|
|
||||||
|
if ! [ -d "$DOM0_UPDATES_DIR" ]; then
|
||||||
|
echo "Dom0 updates dir does not exists: $DOM0_UPDATES_DIR" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
mkdir -p $DOM0_UPDATES_DIR/etc
|
||||||
|
cp /etc/yum.conf $DOM0_UPDATES_DIR/etc/
|
||||||
|
|
||||||
|
# check also for template updates
|
||||||
|
echo "Checking for template updates..." >&2
|
||||||
|
TEMPLATEPKGLIST=`yum check-update -q | cut -f 1 -d ' '`
|
||||||
|
echo "template:$TEMPLATEPKGLIST"
|
||||||
|
|
||||||
|
echo "Checking for dom0 updates..." >&2
|
||||||
|
PKGLIST=`yum --installroot $DOM0_UPDATES_DIR check-update -q | cut -f 1 -d ' '`
|
||||||
|
echo "dom0:$PKGLIST"
|
@ -9,6 +9,8 @@ while [ -n "$1" ]; do
|
|||||||
DOIT=1
|
DOIT=1
|
||||||
elif [ "x--nogui" = "x$1" ]; then
|
elif [ "x--nogui" = "x$1" ]; then
|
||||||
GUI=0
|
GUI=0
|
||||||
|
else
|
||||||
|
break
|
||||||
fi
|
fi
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
@ -21,36 +23,22 @@ fi
|
|||||||
mkdir -p $DOM0_UPDATES_DIR/etc
|
mkdir -p $DOM0_UPDATES_DIR/etc
|
||||||
cp /etc/yum.conf $DOM0_UPDATES_DIR/etc/
|
cp /etc/yum.conf $DOM0_UPDATES_DIR/etc/
|
||||||
|
|
||||||
# check also for template updates
|
PKGLIST="$*"
|
||||||
echo "Checking for template updates..."
|
|
||||||
TEMPLATEPKGLIST=`yum check-update -q | cut -f 1 -d ' '`
|
if [ "x$PKGLIST" = "x" ]; then
|
||||||
if [ -n "$TEMPLATEPKGLIST" ] && [ "$GUI" = 1 ]; then
|
echo "Checking for dom0 updates..."
|
||||||
TEMPLATE_UPDATE_COUNT=`echo "$TEMPLATEPKGLIST" | wc -w`
|
PKGLIST=`yum --installroot $DOM0_UPDATES_DIR check-update -q | cut -f 1 -d ' '`
|
||||||
NOTIFY_UPDATE_COUNT=`cat /var/run/qubes/template_update_last_notify_count 2> /dev/null`
|
|
||||||
if [ "$NOTIFY_UPDATE_COUNT" != "$TEMPLATE_UPDATE_COUNT" ]; then
|
|
||||||
echo -n $TEMPLATE_UPDATE_COUNT > /var/run/qubes/template_update_last_notify_count
|
|
||||||
NOTIFY_PID=`cat /var/run/qubes/template_update_notify.pid 2> /dev/null`
|
|
||||||
if [ -z "$NOTIFY_PID" ] || ! kill -0 $NOTIFY_PID; then
|
|
||||||
NOTIFY_TITLE="Template update"
|
|
||||||
NOTIFY_TEXT="There are $TEMPLATE_UPDATE_COUNT updates available for TemplateVM"
|
|
||||||
NOTIFY_INFO="$NOTIFY_TEXT. Start TemplateVM to update it."
|
|
||||||
( zenity --notification --text "$NOTIFY_TEXT"; zenity --warning --title "$NOTIFY_TITLE" --text "$NOTIFY_INFO") &
|
|
||||||
echo $! > /var/run/qubes/template_update_notify.pid
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Checking for dom0 updates..."
|
if [ -z "$PKGLIST" ]; then
|
||||||
PKGLIST=`yum --installroot $DOM0_UPDATES_DIR check-update -q | cut -f 1 -d ' '`
|
|
||||||
|
|
||||||
if [ -z $PKGLIST ]; then
|
|
||||||
# No new updates
|
# No new updates
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$DOIT" != "1" ]; then
|
if [ "$DOIT" != "1" ]; then
|
||||||
|
PKGCOUNT=`echo $PKGLIST|wc -w`
|
||||||
zenity --question --title="Qubes Dom0 updates" \
|
zenity --question --title="Qubes Dom0 updates" \
|
||||||
--text="Updates for dom0 available. Do you want to download its now?" || exit 0
|
--text="$PKGCOUNT updates for dom0 available. Do you want to download its now?" || exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
mkdir -p "$DOM0_UPDATES_DIR/packages"
|
mkdir -p "$DOM0_UPDATES_DIR/packages"
|
||||||
|
@ -80,6 +80,7 @@ cp qubes_network.rules $RPM_BUILD_ROOT/etc/udev/rules.d/99-qubes_network.rules
|
|||||||
mkdir -p $RPM_BUILD_ROOT/usr/lib/qubes/
|
mkdir -p $RPM_BUILD_ROOT/usr/lib/qubes/
|
||||||
cp setup_ip $RPM_BUILD_ROOT/usr/lib/qubes/
|
cp setup_ip $RPM_BUILD_ROOT/usr/lib/qubes/
|
||||||
cp qubes_download_dom0_updates.sh $RPM_BUILD_ROOT/usr/lib/qubes/
|
cp qubes_download_dom0_updates.sh $RPM_BUILD_ROOT/usr/lib/qubes/
|
||||||
|
cp qubes_check_for_updates.sh $RPM_BUILD_ROOT/usr/lib/qubes/
|
||||||
mkdir -p $RPM_BUILD_ROOT/etc/yum/post-actions
|
mkdir -p $RPM_BUILD_ROOT/etc/yum/post-actions
|
||||||
cp qubes_trigger_sync_appmenus.action $RPM_BUILD_ROOT/etc/yum/post-actions/
|
cp qubes_trigger_sync_appmenus.action $RPM_BUILD_ROOT/etc/yum/post-actions/
|
||||||
mkdir -p $RPM_BUILD_ROOT/usr/lib/qubes
|
mkdir -p $RPM_BUILD_ROOT/usr/lib/qubes
|
||||||
@ -242,4 +243,5 @@ rm -rf $RPM_BUILD_ROOT
|
|||||||
/etc/yum/post-actions/qubes_trigger_sync_appmenus.action
|
/etc/yum/post-actions/qubes_trigger_sync_appmenus.action
|
||||||
/usr/lib/qubes/qubes_trigger_sync_appmenus.sh
|
/usr/lib/qubes/qubes_trigger_sync_appmenus.sh
|
||||||
/usr/lib/qubes/qubes_download_dom0_updates.sh
|
/usr/lib/qubes/qubes_download_dom0_updates.sh
|
||||||
|
/usr/lib/qubes/qubes_check_for_updates.sh
|
||||||
/lib/firmware/updates
|
/lib/firmware/updates
|
||||||
|
Loading…
Reference in New Issue
Block a user