installCDE.src: Add a -destdir <dir> option
authorJon Trulson <jon@radscan.com>
Fri, 25 May 2018 02:07:18 +0000 (20:07 -0600)
committerJon Trulson <jon@radscan.com>
Fri, 1 Jun 2018 04:23:19 +0000 (22:23 -0600)
Using this option, all files are installed under <dir> rather than
root '/'.

cde/admin/IntegTools/dbTools/installCDE.src

index 856d0c58e861e96cc481fd1acc45ce5721dda700..01de97169eeab8a1321c3acbfbc9cd3254246fe9 100755 (executable)
@@ -493,6 +493,7 @@ echo -e "\t\t\t\t\tthen exit"
 echo -e "\t[-DontRunScripts]\t\tstop after installation"
 echo -e "\t[-RunScriptsOnly]\t\tonly execute the scripts"
 echo -e "\t[-configureOnly]\t\tonly configure the desktop"
+echo -e "\t[-destdir dir]\t\tInstall all files under dir/"
 echo -e ""
 echo -e "\tExamples:"
 echo -e ""
@@ -527,7 +528,7 @@ XCOMM don't bother if the fileset doesn't exist
   KORNSHELL $TOOL_DIR/udbToAny.ksh  -toLst -ReleaseStream $PLATFORM \
             $DATABASE_DIR/${2}.udb >  /tmp/${2}.lst
   Log "      - installing ... "
-  KORNSHELL $TOOL_DIR/mkProd -D / -S $BUILD_TREE /tmp/${2}.lst \
+  KORNSHELL $TOOL_DIR/mkProd -D $DESTINATION_DIR -S $BUILD_TREE /tmp/${2}.lst \
             2>/tmp/${2}.err 1>/tmp/${2}.good
   Log "        done."
 
@@ -623,6 +624,8 @@ XCOMM
   CLEAN_DAEMONS="yes"
   theLang=""
   CONFIGURE_ONLY="no"
+  DESTINATION_DIR="/"
+
 
   rm -f $LOGFILE
 
@@ -788,6 +791,15 @@ XCOMM
             CLEAN_DAEMONS="yes"
             shift;
             ;;
+        -destdir) Log "  - Destination Directory"
+           shift;
+           [ $# -ne 0 ] || {
+               USAGE
+               exit 1;
+           }
+           DESTINATION_DIR="$1"
+           shift;
+            ;;
        *) Log "  - unknown option"
            USAGE
            exit 1;
@@ -815,6 +827,18 @@ XCOMM
     exit 1
   fi
 
+  if [ "$DESTINATION_DIR" != "" -a ! -d "$DESTINATION_DIR" ]
+  then
+    Log "Creating $DESTINATION_DIR"
+    mkdir $DESTINATION_DIR
+
+    if [ $? -ne 0 ]
+    then
+        Log "mkdir $DESTINATION_DIR failed"
+        exit 1
+    fi
+  fi
+
   CDEPACKAGE=dt.pkg
   CDETARFILE=dt.tar
   CDETARFILEZ=dttar.Z
@@ -983,7 +1007,7 @@ XCOMM
   fi
 
   Log " "
-  Log "Desktop installed in $INSTALL_LOCATION"
+  Log "Desktop installed in $DESTINATION_DIR/$INSTALL_LOCATION"
 
   if [ "$DO_INSTALL_ONLY" = "yes" ]
   then