r3557@krups: intrigeri | 2005-11-15 14:41:32 +0100

Start to move common functions (maketemp) to lib/tools, and better use autotools for lib/{easydialog,tools}.
This commit is contained in:
intrigeri 2005-11-29 10:09:04 +00:00
parent a9074a138c
commit 13149b9600
5 changed files with 46 additions and 8 deletions

View File

@ -1,6 +1,14 @@
EXTRALIBS = easydialog tools
dist_pkglib_DATA = $(EXTRALIBS)
EXTRA_DIST = easydialog.in tools.in
EXTRALIBRARIES = easydialog.sh edit = sed \
-e "s,@BASH\@,$(BASH),g"
EXTRA_DIST = Makefile.am $(EXTRALIBRARIES) easydialog: easydialog.in
rm -f easydialog
$(edit) easydialog.in > easydialog
dist_pkglib_DATA = $(EXTRALIBRARIES) tools: tools.in
rm -f tools
$(edit) tools.in > tools

View File

@ -111,9 +111,12 @@ sbindir = @sbindir@
sharedstatedir = @sharedstatedir@ sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@ sysconfdir = @sysconfdir@
target_alias = @target_alias@ target_alias = @target_alias@
EXTRALIBRARIES = easydialog.sh EXTRALIBS = easydialog tools
EXTRA_DIST = Makefile.am $(EXTRALIBRARIES) dist_pkglib_DATA = $(EXTRALIBS)
dist_pkglib_DATA = $(EXTRALIBRARIES) EXTRA_DIST = easydialog.in tools.in
edit = sed \
-e "s,@BASH\@,$(BASH),g"
all: all-am all: all-am
.SUFFIXES: .SUFFIXES:
@ -285,6 +288,14 @@ uninstall-am: uninstall-dist_pkglibDATA uninstall-info-am
pdf-am ps ps-am uninstall uninstall-am \ pdf-am ps ps-am uninstall uninstall-am \
uninstall-dist_pkglibDATA uninstall-info-am uninstall-dist_pkglibDATA uninstall-info-am
easydialog: easydialog.in
rm -f easydialog
$(edit) easydialog.in > easydialog
tools: tools.in
rm -f tools
$(edit) tools.in > tools
# Tell versions [3.59,3.63) of GNU make to not export all variables. # Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded. # Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT: .NOEXPORT:

View File

@ -1,4 +1,4 @@
#!/bin/bash #!@BASH@
# copyright 2002 lmoore@tump.com under the terms of the GNU LGPL. # copyright 2002 lmoore@tump.com under the terms of the GNU LGPL.
# additions 2005 collective@riseup.net # additions 2005 collective@riseup.net

19
lib/tools.in Normal file
View File

@ -0,0 +1,19 @@
#!@BASH@
#
# create a temporary file in a secure way.
#
function maketemp() {
if [ -x /bin/mktemp ]
then
local tempfile=`mktemp /tmp/$1.XXXXXXXX`
else
DATE=`date`
sectmp=`echo $DATE | /usr/bin/md5sum | cut -d- -f1`
local tempfile=/tmp/$1.$sectmp
fi
echo $tempfile
}

View File

@ -215,7 +215,7 @@ if [ ! -d "$configdirectory" ]; then
exit 1 exit 1
fi fi
. $libdir/easydialog.sh . $libdir/easydialog
if [ "$UID" != "0" ]; then if [ "$UID" != "0" ]; then
msgBox "warning" "ninjahelper must be run by root!" msgBox "warning" "ninjahelper must be run by root!"