source: src-sh/warden/scripts/backend/checkupdates.sh @ 22842a8

9.1-release9.2-releasereleng/10.0releng/10.0.1releng/10.0.2releng/10.0.3releng/10.1
Last change on this file since 22842a8 was 22842a8, checked in by Kris Moore <kris@…>, 21 months ago

Fix bugs checking for updates to a jail and showing MB usage on disk

  • Property mode set to 100755
File size: 1.8 KB
Line 
1#!/bin/sh
2# Script to check for jail updates
3# Args $1 = JAILNAME
4######################################################################
5
6# Source our functions
7PROGDIR="/usr/local/share/warden"
8
9# Source our variables
10. ${PROGDIR}/scripts/backend/functions.sh
11
12JAILNAME="$1"
13
14if [ -z "${JAILNAME}" ]
15then
16  echo "ERROR: You must specify a jail to check"
17  exit 5
18fi
19
20if [ -z "${JDIR}" ]
21then
22  echo "ERROR: JDIR is unset!!!!"
23  exit 5
24fi
25
26JAILDIR="${JDIR}/${JAILNAME}"
27
28if [ ! -d "${JAILDIR}" -a "${JAILNAME}" != "all" ]
29then
30  echo "ERROR: No jail located at ${JAILDIR}"
31  exit 5
32fi
33
34
35# End of error checking, now start update checking
36#####################################################################
37
38# Check for updates
39if [ "${JAILNAME}" = "all" ] ; then
40  cd ${JDIR}
41  for i in `ls -d .*.meta`
42  do
43    JAILNAME=`echo ${i}|sed 's|.meta$||'|sed 's|^.||'`
44    HOST="`cat ${i}/host`"
45    set_warden_metadir
46    if [ -e "${JMETADIR}/jail-linux" ] ; then continue; fi
47
48    echo "Checking for jail updates to ${HOST}"
49    echo "################################################"
50 
51    # Check for meta-pkg updates
52    pc-metapkgmanager --chroot ${JDIR}/${JAILNAME} checkup
53
54    # Check for system-updates
55    chroot ${JDIR}/${JAILNAME} cat /usr/sbin/freebsd-update | sed 's|! -t 0|-z '1'|g' | /bin/sh -s 'fetch'
56  done
57else
58  set_warden_metadir
59 
60  if [ -e "${JMETADIR}/jail-linux" ] ; then
61    echo "ERROR: Cannot check for updates to Linux Jails.. Please use any included Linux utilities for your disto."
62    exit 5
63  fi
64
65   echo "Checking for jail updates to ${JAILNAME}..."
66   echo "################################################"
67   # Check for meta-pkg updates
68   pc-metapkgmanager --chroot ${JDIR}/${JAILNAME} checkup
69
70   # Check for system-updates
71   chroot ${JDIR}/${JAILNAME} cat /usr/sbin/freebsd-update | sed 's|! -t 0|-z '1'|g' | /bin/sh -s 'fetch'
72fi
Note: See TracBrowser for help on using the repository browser.