[Lunar-commits] <lunar> Merge from theedge: ld_add|remove, utf-8 view support

Auke Kok sofar at lunar-linux.org
Mon Jul 2 04:43:16 CEST 2012


commit 9dc4e9b70697b81bc49aa9742cf0f91221dcea6e
Author: Auke Kok <sofar at lunar-linux.org>
Date:   Mon Mar 3 18:12:43 2008 +0000

    Merge from theedge: ld_add|remove, utf-8 view support
---
 var/lib/lunar/functions/misc.lunar |   36 ++++++++++++++++++++++++++++++++++++
 var/lib/lunar/functions/view.lunar |    5 +++--
 2 files changed, 39 insertions(+), 2 deletions(-)

diff --git a/var/lib/lunar/functions/misc.lunar b/var/lib/lunar/functions/misc.lunar
index 6d3eb52..1be3080 100644
--- a/var/lib/lunar/functions/misc.lunar
+++ b/var/lib/lunar/functions/misc.lunar
@@ -24,7 +24,43 @@
 #                                                          #
 ############################################################
 
+# function : ld_add
+# usage    : ld_add <directory>
+# purpose  : Add a path to ld.so.conf
+
+ld_add() {
+	debug_msg "ld_add ($@)"
+
+	if [ ! -z "$1" ] && [ -d "$1" ] ; then
+		if [ ! `grep -s $1 /etc/ld.so.conf` ] ; then
+			verbose_msg "Adding $1 to ld.so.conf"
+			echo "$1" >> /etc/ld.so.conf
+			ldconfig
+		fi
+	fi
+}
+
+# function : ld_remove
+# usage    : ld_remove <directory>
+# purpose  : Remove a path from ld.so.conf
+
+ld_remove() {
+	debug_msg "ld_remove ($@)"
+
+	if [ ! -z "$1" ] && [ -d "$1" ] ; then
+		if [ `grep -s $1 /etc/ld.so.conf` ] ; then
 
+			TMP_LD_CONF=$(temp_create "ldsoconf")
+			verbose_msg "Removing $1 from ld.so.conf"
+
+			grep -v $1 /etc/ld.so.conf > $TMP_LD_CONF
+			cat $TMP_LD_CONF > /etc/ld.so.conf
+			ldconfig
+
+			temp_destroy $TMP_LD_CONF
+		fi
+	fi
+}
 
 # function : directories
 # usage    : VARIABLE=`directories < dirlistfile`
diff --git a/var/lib/lunar/functions/view.lunar b/var/lib/lunar/functions/view.lunar
index e0b913b..e96a26b 100644
--- a/var/lib/lunar/functions/view.lunar
+++ b/var/lib/lunar/functions/view.lunar
@@ -14,13 +14,14 @@ view_file()  {
     # show a file $1
     case $(file -b $1 | cut -d' ' -f1) in
       ASCII) cat $1         | ${PAGER:-less} ;;
+      UTF-8) cat $1         | ${PAGER:-less} ;;
       bzip2) cat $1 | bzcat | ${PAGER:-less} ;;
        gzip) cat $1 | zcat  | ${PAGER:-less} ;;
        data) cat $1         | ${PAGER:-less} ;;
     esac
   else
     cat | ${PAGER:-less}
-  fi  
-}  
+  fi
+}
 
 


More information about the Lunar-commits mailing list