dom0+vm: use qubes_download_dom0_updates.sh instead of qubes_check_for_updates.sh

Remove code duplication. Implemented required --check-only option to
qubes_download_dom0_updates.sh.
This commit is contained in:
Marek Marczykowski 2011-09-15 00:18:56 +02:00
parent a46676a14b
commit 855664e6e5
4 changed files with 14 additions and 23 deletions

View File

@ -1,20 +0,0 @@
#!/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
sed -i '/^reposdir\s*=/d' $DOM0_UPDATES_DIR/etc/yum.conf
# 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"

View File

@ -5,6 +5,7 @@ DOM0_UPDATES_DIR=/var/lib/qubes/dom0-updates
DOIT=0
GUI=1
CLEAN=0
CHECK_ONLY=0
OPTS="--installroot $DOM0_UPDATES_DIR"
PKGLIST=
while [ -n "$1" ]; do
@ -18,6 +19,9 @@ while [ -n "$1" ]; do
--clean)
CLEAN=1
;;
--check-only)
CHECK_ONLY=1
;;
-*)
OPTS="$OPTS $1"
;;
@ -48,6 +52,15 @@ else
PKGS_FROM_CMDLINE=1
fi
if [ "$CHECK_ONLY" = "1" ]; then
# check also for template updates
echo "Checking for template updates..." >&2
TEMPLATEPKGLIST=`yum check-update -q | cut -f 1 -d ' '`
echo "template:$TEMPLATEPKGLIST"
echo "dom0:$PKGLIST"
exit
fi
if [ -z "$PKGLIST" ]; then
# No new updates
exit 0

View File

@ -22,7 +22,7 @@ flock --nonblock -s 200 || exit 1
/usr/lib/qubes/sync_rpmdb_updatevm.sh
while true; do
# Output of this script is UNTRUSTED!
$QREXEC_CLIENT -d $UPDATES_VM "user:/usr/lib/qubes/qubes_check_for_updates.sh" |\
$QREXEC_CLIENT -d $UPDATES_VM "user:/usr/lib/qubes/qubes_download_dom0_updates.sh --check-only" |\
while IFS=: read -n 819200 domain packages; do
if [ "x$domain" = "xtemplate" -a -n "$packages" ]; then
TEMPLATE_UPDATE_COUNT=`echo "$packages" | wc -w`

View File

@ -81,7 +81,6 @@ cp qubes_memory.rules $RPM_BUILD_ROOT/etc/udev/rules.d/50-qubes_memory.rules
mkdir -p $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_check_for_updates.sh $RPM_BUILD_ROOT/usr/lib/qubes/
mkdir -p $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
@ -247,5 +246,4 @@ rm -rf $RPM_BUILD_ROOT
/etc/yum/post-actions/qubes_trigger_sync_appmenus.action
/usr/lib/qubes/qubes_trigger_sync_appmenus.sh
/usr/lib/qubes/qubes_download_dom0_updates.sh
/usr/lib/qubes/qubes_check_for_updates.sh
/lib/firmware/updates