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:31:19 -0300 |
commit | 0fd71e83bcd2e00aac489ad76a71b38cda9dfc6b (patch) | |
tree | f67718c3b73e617ac4ff949e94231d030eb6412c /src/usr/local/sbin/pfSense-upgrade | |
parent | bb8e381a38e59a6fecbeb05d9e829edbc22deb0f (diff) | |
download | pfsense-0fd71e83bcd2e00aac489ad76a71b38cda9dfc6b.zip pfsense-0fd71e83bcd2e00aac489ad76a71b38cda9dfc6b.tar.gz |
Make pkg_lock() and pkg_unlock() work with wildcards
Diffstat (limited to 'src/usr/local/sbin/pfSense-upgrade')
-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 478e409..0fdb326 100755 --- a/src/usr/local/sbin/pfSense-upgrade +++ b/src/usr/local/sbin/pfSense-upgrade @@ -226,27 +226,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() { |