1
0
Fork 0
forked from mirrors/openup

Explicitely notify that we are running in dry run mode.

This commit is contained in:
Antoine Jacoutot 2013-08-09 11:17:04 +02:00
commit 3266260048

20
openup
View file

@ -67,6 +67,10 @@ error() {
echo -n "*** ERROR: $@"
}
print_action() {
echo "===> ${@}${DRYRUN}"
}
get_cert() {
local _CMD
@ -78,14 +82,14 @@ get_cert() {
grep -q "${PKG_CERT_FPRINT}" && return
done
echo "===> Downloading certificate"
print_action "Downloading certificate"
_CMD="ftp -Vo ${TMPCERT} ${PKG_CERT_URL}"
echo "==> ${_CMD}"
if [ -z "${DRYRUN}" ]; then
eval ${_CMD} || exit 1
fi
echo "===> Installing certificate"
print_action "Installing certificate"
_CMD="cat ${TMPCERT} >>/etc/ssl/pkgca.pem"
echo "==> ${_CMD}"
if [ -z "${DRYRUN}" ]; then
@ -96,7 +100,7 @@ get_cert() {
update_self() {
local _CMD _N
echo "===> Checking for openup(8) update"
print_action "Checking for openup(8) update"
_CMD="ftp -Vo ${TMPUPD} ${OPENUP_URL}"
echo "==> ${_CMD}"
if [ -z "${DRYRUN}" ]; then
@ -106,7 +110,7 @@ update_self() {
_N=$(grep -Eo '^OPENUP_VERSION=.*' ${TMPUPD} | awk -F '=' '{ print $2 }')
[[ -n "${_N}" ]] && \
if [ "${OPENUP_VERSION}" -lt "${_N}" ]; then
echo "===> Updating openup(8) from version ${OPENUP_VERSION} to version ${_N}"
print_action "Updating openup(8) from version ${OPENUP_VERSION} to version ${_N}"
_CMD="cat ${TMPUPD} >${MEESA}"
echo "==> ${_CMD}"
eval ${_CMD} # non-fatal
@ -125,7 +129,7 @@ update_binpatches() {
_BP=$(pkg_info -Q binpatch${REL_INT}-$(arch -s) | sed 's/.[^-]*$//' | sort -u)
if [ -n "$_BP" ]; then
echo "===> Updating binpatch(es)"
print_action "Updating binpatch(es)"
_CMD="pkg_add ${pkg_opt} ${_BP}"
echo "==> ${_CMD}"
eval ${_CMD}
@ -135,7 +139,7 @@ update_binpatches() {
update_pkg() {
local _CMD
echo "===> Updating package(s)"
print_action "Updating package(s)"
_CMD="pkg_add -u ${pkg_opt}"
echo "==> ${_CMD}"
eval ${_CMD}
@ -144,7 +148,7 @@ update_pkg() {
update_fw() {
local _CMD
echo "===> Updating firmware(s)"
print_action "Updating firmware(s)"
_CMD="fw_update ${fw_opt}"
echo "==> ${_CMD}"
eval ${_CMD}
@ -154,7 +158,7 @@ while getopts 'SUn' arg; do
case ${arg} in
S) NOSIG=1; pkg_opt="${pkg_opt} -D nosig" ;;
U) NOSELFUPDATE=1 ;;
n) DRYRUN=1; pkg_opt="${pkg_opt} -n -D nosig"; fw_opt="-n" ;;
n) DRYRUN=" (dry run)"; pkg_opt="${pkg_opt} -n -D nosig"; fw_opt="-n" ;;
*) usage ;;
esac
done