modify checks in (un)installation script
authorDennis Groenen <tj.groenen@gmail.com>
Tue, 16 Oct 2012 17:06:12 +0000 (19:06 +0200)
committerDennis Groenen <tj.groenen@gmail.com>
Tue, 16 Oct 2012 18:47:41 +0000 (20:47 +0200)
debian/busybox-power.postinst
debian/busybox-power.prerm
debian/scripts/functions

index 74a2edb..eefd139 100644 (file)
@@ -18,6 +18,7 @@ EXECPWR="$INSTALLDIR/busybox.power"
 DISTBIN="/bin/busybox.distrib"
 
 VERBOSE="0"
+SYMLINK="1"
 
 INSTBINARY_SHA1=`$EXECPWR sha1sum $EXECPWR | $EXECPWR awk '{ print $1 }'`
 ORIGBINARY_SHA1=`$EXECPWR sha1sum /bin/busybox | $EXECPWR awk '{ print $1 }'`
@@ -36,9 +37,8 @@ CHECK_APPLETSFILE() {
 # Check whether symlinks have been made before
 CHECK_SYMLINKSFILE() {
     if test -e $INSTALLDIR/busybox-power.symlinks; then
-      echo "error: symlinks already seem to be made?"
-      echo "  this script is not supposed to be ran twice"
-      exit 1
+      ECHO_VERBOSE "symlinks are already made, skipping creation"
+      SYMLINK="0"
     fi
 }
 
@@ -132,12 +132,14 @@ ECHO_VERBOSE "  binary: $EXECPWR"
 ECHO_VERBOSE "  version string: `$EXECPWR | $EXECPWR head -n 1`"
 CHECK_ENV && ECHO_VERBOSE "  environment: $ENVIRONMENT"
 
-CHECK_STANDALONE
 CHECK_APPLETSFILE
 CHECK_SYMLINKSFILE
 if test "$ENVIRONMENT" != "SDK"; then
-  CHECK_ROOT; fi
+  CHECK_ROOT
+fi
 BACKUP
 INSTALL
-SYMLINK
+if test $SYMLINK == 1; then
+  SYMLINK
+fi
 
index dafdf88..005916b 100644 (file)
@@ -184,13 +184,12 @@ ECHO_VERBOSE "  binary: $EXECPWR"
 ECHO_VERBOSE "  version string: `$EXECPWR | $EXECPWR head -n 1`"
 CHECK_ENV && ECHO_VERBOSE "  environment: $ENVIRONMENT"
 
-CHECK_STANDALONE
 CHECK_SYMLINKSFILE
 if test "$ENVIRONMENT" != "SDK"; then
   CHECK_ROOT
-  CHECK_BACKUP
-  CHECK_INSTALLEDBIN
 fi
+CHECK_BACKUP
+CHECK_INSTALLEDBIN
 if test -e /tmp/busybox-power-error; then
   # An error has occured during the checks
   DISPLAY_ERRORS
index 6d532b6..436b277 100644 (file)
@@ -31,24 +31,10 @@ CHECK_ENV() {
     fi
 }
 
-# Check whether I'm running standalone
-CHECK_STANDALONE() {
-    #if test -n "`pgrep dpkg`" -o "`pgrep apt`"
-    if ! lsof /var/lib/dpkg/lock >> /dev/null; then 
-      echo "error: you're running me as a stand-alone application"
-      echo "  do not do this, I will be called automatically when"
-      echo "  required by busybox-power"
-      exit 1
-    fi
-}
-
 # Check whether the user is root
 CHECK_ROOT() {
     if test "`$EXECPWR id -u`" -ne 0; then
-      echo "error: you're not running me as root, aborting"
-      echo "  also, DO NOT run me as a stand-alone application"
-      echo "  I will be called automatically when required by"
-      echo "  busybox-power"
+      echo "error: you're not running me as root"
       exit 1
     fi
 }