summaryrefslogtreecommitdiff
path: root/bin/pkg
diff options
context:
space:
mode:
authorDaniel Friesel <derf@derf.homelinux.org>2008-09-18 17:39:24 +0200
committerDaniel Friesel <derf@derf.homelinux.org>2008-09-18 17:39:24 +0200
commit631f0deafc38d245e13e1ccbc2a6076c46eee676 (patch)
treea9c85345f53e36a30e35cd02cace93a08adcc7be /bin/pkg
parent7d42e1976ed39df414ca2373a0a481cd5e074732 (diff)
bin/pkg: Use less external commands
Diffstat (limited to 'bin/pkg')
-rwxr-xr-xbin/pkg10
1 files changed, 5 insertions, 5 deletions
diff --git a/bin/pkg b/bin/pkg
index 63538ba..4d3b2e1 100755
--- a/bin/pkg
+++ b/bin/pkg
@@ -76,9 +76,9 @@ if [[ ! -d $PDIR ]] {
##
# Protocol
-if (grep '^ssh' <<< $PKG_ROOT &> /dev/null) {
+if [[ ${PKG_ROOT#ssh} != $PKG_ROOT ]] {
PKG_PROTO='ssh'
- } elif (grep '^/' <<< $PKG_ROOT &> /dev/null) {
+} elif [[ ${PKG_ROOT#'/'} != $PKG_ROOT ]] {
PKG_PROTO='file'
} else {
false
@@ -86,12 +86,12 @@ if (grep '^ssh' <<< $PKG_ROOT &> /dev/null) {
# Host
if [[ $PKG_PROTO = 'ssh' ]] {
- PKG_HOST=$(sed 's!^ssh://!!' <<< $PKG_ROOT | sed -r 's!^([^/]*)/.*$!\1!')
+ PKG_HOST=$(sed -r 's!^([^/]*)/.*$!\1!' <<< ${PKG_ROOT#'ssh://'})
}
# Remote path
if [[ $PKG_PROTO = 'ssh' ]] {
- PKG_PATH=$(sed 's!^ssh://'"$PKG_HOST"'/!!' <<< $PKG_ROOT)
+ PKG_PATH=${PKG_ROOT#"ssh://$PKG_HOST"}
} elif [[ $PKG_PROTO = 'file' ]] {
PKG_PATH=$PKG_ROOT
}
@@ -209,7 +209,7 @@ list_type_local () {
list_update_remote () {
if [[ $PKG_PROTO = 'ssh' ]] {
- scp -q $PKG_HOST:$(cut -d / -f 4- <<< $PKG_ROOT | sed 's!~/!!')/.list .list-remote
+ scp -q $PKG_HOST:${$(cut -d / -f 4- <<< $PKG_ROOT)/'~/'}/.list .list-remote
} elif [[ $PKG_PROTO = 'file' ]] {
cp $PKG_ROOT/.list .list-remote
}