diff options
author | Renato Botelho <renato@netgate.com> | 2016-09-16 16:23:53 -0300 |
---|---|---|
committer | Renato Botelho <renato@netgate.com> | 2016-09-16 16:23:53 -0300 |
commit | d5be878f8053cd91c8d736ae1136610af1a8d26d (patch) | |
tree | 0a4dceb3cbcefd9260de90ac1e76ed4e53d4da06 /src | |
parent | 561463d229f7f22c40d5bfb64d35c6559f6788cf (diff) | |
download | pfsense-d5be878f8053cd91c8d736ae1136610af1a8d26d.zip pfsense-d5be878f8053cd91c8d736ae1136610af1a8d26d.tar.gz |
Make pkg_lock() and pkg_unlock() work with wildcards
Diffstat (limited to 'src')
-rwxr-xr-x | src/usr/local/sbin/pfSense-upgrade | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/src/usr/local/sbin/pfSense-upgrade b/src/usr/local/sbin/pfSense-upgrade index c6c97a3..394e6cb 100755 --- a/src/usr/local/sbin/pfSense-upgrade +++ b/src/usr/local/sbin/pfSense-upgrade @@ -194,27 +194,33 @@ fetch_upgrade_packages() { } pkg_lock() { - local _pkg="${1}" + local _pkgs="${1}" - if [ -z "${_pkg}" ]; then + if [ -z "${_pkgs}" ]; then return fi - if [ "$(pkg ${pkg_chroot} query %k ${_pkg})" = "0" ]; then - _exec "pkg ${pkg_chroot} lock ${_pkg}" "Locking package ${_pkg}" mute - fi + for _pkg in $(pkg query -g %n "${_pkgs}"); do + if [ "$(pkg ${pkg_chroot} query %k ${_pkg})" = "0" ]; then + _exec "pkg ${pkg_chroot} lock ${_pkg}" \ + "Locking package ${_pkg}" mute + fi + done } pkg_unlock() { - local _pkg="${1}" + local _pkgs="${1}" - if [ -z "${_pkg}" ]; then + if [ -z "${_pkgs}" ]; then return fi - if [ "$(pkg ${pkg_chroot} query %k ${_pkg})" = "1" ]; then - _exec "pkg ${pkg_chroot} unlock ${_pkg}" "Unlocking package ${_pkg}" mute - fi + for _pkg in $(pkg query -g %n "${_pkgs}"); do + if [ "$(pkg ${pkg_chroot} query %k ${_pkg})" = "1" ]; then + _exec "pkg ${pkg_chroot} unlock ${_pkg}" \ + "Unlocking package ${_pkg}" mute + fi + done } pkg_update() { |