Skip to content

Commit

Permalink
Adjusted service staus, corrected patterns for zsh.
Browse files Browse the repository at this point in the history
  • Loading branch information
wayneeseguin committed Oct 6, 2011
1 parent bb569c8 commit b96ad5e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 28 deletions.
33 changes: 16 additions & 17 deletions core/internal/shell/package/functions
Expand Up @@ -129,53 +129,53 @@ __sm.package.define()
fi

case "$key" in
name)
(name)
package_name="${value}"
;;
version)
(version)
package_version="${value}"
;;
file)
(file)
package_file="${value}"
;;
dir)
(dir)
package_dir="${value}"
;;
url)
(url)
package_url="${value}"
;;
base_url)
(base_url)
package_base_url="${value}"
;;
docs_url)
(docs_url)
package_docs_url="${value}"
;;
patches_url)
(patches_url)
package_patches_url="${value}"
;;
md5_url)
(md5_url)
package_md5_url="${value}"
;;
bin_path)
(bin_path)
bin_path="${value}"
;;
packages_path)
(packages_path)
packages_path="${value}"
;;
source_path)
(source_path)
source_path="${value}"
;;
target_path)
(target_path)
target_path="${value}"
;;
archive_format)
(archive_format)
archive_format="${value}"
;;
# TODO: Simplify into
#(+([[[:alnum:]]|])_path|name|version|url|md5_url)
# eval "${key}=${value}"
# ;;
*)
(*)
__sm.log.fail "Unknown key '${key}' (value: ${value})."
;;
esac
Expand Down Expand Up @@ -308,8 +308,7 @@ __sm.package.gnu.install()
__sm.package.set.cc
__sm.package.set.ldflags

if __sm.package.versions.installed | grep -q "${package_version}" &&
[[ "${force_flag}" != "1" ]]
if __sm.package.versions.installed | grep -q "${package_version}" && (( force_flag != 1 ))
then
log "The ${package_name} ${package_version} package is already installed.
To force it to reinstall, call:\n\tsm ${package_name} package install force\n"
Expand Down
17 changes: 6 additions & 11 deletions core/internal/shell/service/functions
Expand Up @@ -781,14 +781,9 @@ __sm.service.status()

if __sm.command.exists lsof
then
typeset cwd binary libraries tcp_ports udp_ports sockets logs string
cwd=""
binary=""
libraries=()
tcp_ports=()
udp_ports=()
sockets=()
logs=()
typeset cwd binary
typeset -a libraries tcp_ports udp_ports sockets logs string

while read -r line
do
case "$line" in
Expand All @@ -799,7 +794,7 @@ __sm.service.status()
binary="${line##* }"
;;
(*/lib/*)
string="${line%% (*}"
string="${line%% \(*}"
libraries+=("${string##* }")
;;
(*.log*)
Expand All @@ -809,12 +804,12 @@ __sm.service.status()
sockets+=("${line##* }")
;;
(*TCP*)
string="${line%% (*}"
string="${line%% \(*}"
tcp_ports+=("${string##* }")
;;
(*)
true # ignore
;;
;;
esac
done < <(lsof -U -p ${pid})

Expand Down

0 comments on commit b96ad5e

Please sign in to comment.