first check-in of feisty meow codebase. many things broken still due to recent
[feisty_meow.git] / scripts / core / create_tempdir.sh
1 #!/bin/bash
2
3 # create_tempdir:
4 #
5 # This creates a temporary directory for transient files if such a directory
6 # does not already exist.
7
8 source $SHELLDIR/core/date_stringer.sh
9
10 if [ ! -z "$SHELL_DEBUG" ]; then echo creating temporary directory...; fi
11
12 if [ -z "$TMP" ]; then
13   export TMP=$HOME/.tmp
14     # main declaration of the transients area.
15   if [ "$OS" = "Windows_NT" ]; then
16     export TMP=c:/tmp
17   fi
18 fi
19
20 LOG_FILE=$TMP/zz_transients.log
21   # log file for this script.
22
23 word=Verified
24 if [ ! -d "$TMP" ]; then
25   mkdir $TMP
26   word=Created
27 fi
28 if [ -z "$LIGHTWEIGHT_INIT" ]; then
29   echo "$word transient area \"$TMP\" for $USER on $(date_stringer)." >>$LOG_FILE
30 fi
31
32 # set other temporary variables to the same place as TMP.
33 export TEMP=$TMP
34
35 # Make sure no one else is playing around in the temporary directory.
36 chmod 700 $TMP
37
38 if [ ! -z "$SHELL_DEBUG" ]; then echo done creating temporary directory....; fi
39