aboutsummaryrefslogtreecommitdiff
path: root/sh
diff options
context:
space:
mode:
Diffstat (limited to 'sh')
-rw-r--r--sh/functions.sh96
-rwxr-xr-xsh/gendepends.sh1
-rw-r--r--sh/init-common-post.sh1
-rwxr-xr-xsh/net.sh1
-rw-r--r--sh/rc-mount.sh1
-rwxr-xr-xsh/runscript.sh1
6 files changed, 7 insertions, 94 deletions
diff --git a/sh/functions.sh b/sh/functions.sh
index 4c8843e8..f6c51f89 100644
--- a/sh/functions.sh
+++ b/sh/functions.sh
@@ -1,4 +1,6 @@
-# Copyright 1999-2007 Gentoo Foundation
+# Allow any sh script to work with einfo functions and friends
+# We also provide a few helpful functions for other programs to use
+
# Copyright 2007 Roy Marples
# All rights reserved
@@ -37,70 +39,6 @@ eoutdent() {
return 0
}
-# Safer way to list the contents of a directory,
-# as it do not have the "empty dir bug".
-#
-# char *dolisting(param)
-#
-# print a list of the directory contents
-#
-# NOTE: quote the params if they contain globs.
-# also, error checking is not that extensive ...
-#
-dolisting() {
- local x= y= mylist= mypath="$*"
-
- # Here we use file globbing instead of ls to save on forking
- for x in ${mypath}; do
- [ ! -e "${x}" ] && continue
-
- if [ -L "${x}" -o -f "${x}" ]; then
- mylist="${mylist} "${x}
- elif [ -d "${x}" ]; then
- [ "${x%/}" != "${x}" ] && x=${x%/}
-
- for y in "${x}"/*; do
- [ -e "${y}" ] && mylist="${mylist} ${y}"
- done
- fi
- done
-
- echo "${mylist# *}"
-}
-
-# bool is_older_than(reference, files/dirs to check)
-#
-# return 0 if any of the files/dirs are newer than
-# the reference file
-#
-# EXAMPLE: if is_older_than a.out *.o; then ...
-is_older_than() {
- local x= ref="$1"
- shift
-
- for x; do
- [ -e "${x}" ] || continue
- # We need to check the mtime if it's a directory too as the
- # contents may have changed.
- [ "${x}" -nt "${ref}" ] && return 0
- [ -d "${x}" ] && is_older_than "${ref}" "${x}"/* && return 0
- done
-
- return 1
-}
-
-uniqify() {
- local result=
- while [ -n "$1" ]; do
- case " ${result} " in
- *" $1 "*);;
- *) result="${result} $1";;
- esac
- shift
- done
- echo "${result# *}"
-}
-
yesno()
{
[ -z "$1" ] && return 1
@@ -119,24 +57,6 @@ yesno()
esac
}
-KV_to_int() {
- [ -z $1 ] && return 1
-
- local x=${1%%-*}
- local KV_MAJOR=${x%%.*}
- x=${x#*.}
- local KV_MINOR=${x%%.*}
- x=${x#*.}
- local KV_MICRO=${x%%.*}
- local KV_int=$((${KV_MAJOR} * 65536 + ${KV_MINOR} * 256 + ${KV_MICRO} ))
-
- # We make version 2.2.0 the minimum version we will handle as
- # a sanity check ... if its less, we fail ...
- [ "${KV_int}" -lt 131584 ] && return 1
-
- echo "${KV_int}"
-}
-
_sanitize_path() {
local IFS=":" p= path=
for p in ${PATH}; do
@@ -151,12 +71,10 @@ _sanitize_path() {
# Allow our scripts to support zsh
if [ -n "${ZSH_VERSION}" ]; then
- emulate sh
- NULLCMD=:
- # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
- # is contrary to our usage. Disable this feature.
- alias -g '${1+"$@"}'='"$@"'
- setopt NO_GLOB_SUBST
+ emulate sh
+ NULLCMD=:
+ alias -g '${1+"$@"}'='"$@"'
+ setopt NO_GLOB_SUBST
fi
# Add our bin to $PATH
diff --git a/sh/gendepends.sh b/sh/gendepends.sh
index f6c6edb4..b162e750 100755
--- a/sh/gendepends.sh
+++ b/sh/gendepends.sh
@@ -1,7 +1,6 @@
#!/bin/sh
# Shell wrapper to list our dependencies
-# Copyright 2007 Gentoo Foundation
# Copyright 2007 Roy Marples
# All rights reserved
diff --git a/sh/init-common-post.sh b/sh/init-common-post.sh
index 8e3e4b54..b5607631 100644
--- a/sh/init-common-post.sh
+++ b/sh/init-common-post.sh
@@ -1,4 +1,3 @@
-# Copyright 2007 Gentoo Foundation
# Copyright 2007 Roy Marples
# All rights reserved
diff --git a/sh/net.sh b/sh/net.sh
index a39c28bf..07ac1c20 100755
--- a/sh/net.sh
+++ b/sh/net.sh
@@ -1,5 +1,4 @@
#!/sbin/runscript
-# Copyright 1999-2007 Gentoo Foundation
# Copyright 2007 Roy Marples
# All rights reserved
diff --git a/sh/rc-mount.sh b/sh/rc-mount.sh
index 19f469e0..ddfe5223 100644
--- a/sh/rc-mount.sh
+++ b/sh/rc-mount.sh
@@ -1,4 +1,3 @@
-# Copyright 2007 Gentoo Foundation
# Copyright 2007 Roy Marples
# All rights reserved
diff --git a/sh/runscript.sh b/sh/runscript.sh
index 9ad22d45..a3b3cdc3 100755
--- a/sh/runscript.sh
+++ b/sh/runscript.sh
@@ -1,7 +1,6 @@
#!/bin/sh
# Shell wrapper for runscript
-# Copyright 1999-2007 Gentoo Foundation
# Copyright 2007 Roy Marples
# All rights reserved