aboutsummaryrefslogtreecommitdiffstats
path: root/rc.d/init.d/functions
diff options
context:
space:
mode:
Diffstat (limited to 'rc.d/init.d/functions')
-rwxr-xr-xrc.d/init.d/functions21
1 files changed, 21 insertions, 0 deletions
diff --git a/rc.d/init.d/functions b/rc.d/init.d/functions
index 25b9d1e2..8e76c6d7 100755
--- a/rc.d/init.d/functions
+++ b/rc.d/init.d/functions
@@ -71,6 +71,27 @@ checkpid() {
return 1
}
+__basename() {
+ echo ${@##*/}
+}
+__dirname() {
+ f=$@
+ b=$(__basename "$f")
+ if [ "$b" = "$f" ]; then
+ echo "."
+ return
+ fi
+ d=${f//\/$b/}
+ echo $d
+}
+
+__readlink() {
+ f=$@
+ l=$(ls -bl "$f"|(read a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 link rest; echo $link))
+ d=$(__dirname "$f")/./$(__dirname $l )
+ (cd "$d" ;echo $(pwd -P)/$(__basename $l ));
+}
+
# __umount_loop awk_program fstab_file first_msg retry_msg umount_args
# awk_program should process fstab_file and return a list of fstab-encoded
# paths; it doesn't have to handle comments in fstab_file.