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