*** empty log message ***
authorhachti <hachti>
Sat, 25 Aug 2007 11:54:12 +0000 (11:54 +0000)
committerhachti <hachti>
Sat, 25 Aug 2007 11:54:12 +0000 (11:54 +0000)
setup.sh [new file with mode: 0755]

diff --git a/setup.sh b/setup.sh
new file mode 100755 (executable)
index 0000000..3679523
--- /dev/null
+++ b/setup.sh
@@ -0,0 +1,115 @@
+#!/bin/bash
+
+#
+# This script produces a h316rc file which has to be sourced by
+# the user's shell.
+#
+# Usage: Just run and answer the questions. Then use
+#        the h316rc file by typing ". h316rc". You
+#        can also include that into your .bashrc etc.
+#        All paths in the file will be absolut.
+
+
+write_rc(){
+       echo "Writing out configuration file."
+       rm -f h316rc
+       touch h316rc || echo "Error! Could not write to h316rc."
+       cat > h316rc <<EOF      
+# h316rc generated by Hachti's install.sh
+export H316=$H316
+export PATH=\$H316/bin:\$PATH
+EOF
+}
+
+write_script(){
+    echo "Writing out start script."
+    rm -f H316.sh
+    touch H316.sh || echo "Error! Could not write to H316.sh."
+   cat > H316.sh <<EOF 
+#!/bin/bash
+# H316.sh generated by Hachti's install.sh
+export H316=$H316
+echo "Now you are in the H316 build environment."
+bash --init-file \$H316/h316rc
+echo "Left H316 build environment."
+EOF
+chmod +x H316.sh
+}
+
+good_luck(){
+cat <<EOF
+
+***************************************************************
+
+Now the necessary environment for the H316 build system
+has been set up. 
+
+You have one possibility:
+a) Source the h316rc file into your current shell!
+
+Then you can run
+               "make" or "make all"
+to build all the stuff inside. When make successfully finishes,
+you are ready to go.
+
+Have a lot of fun and good luck!
+(You should have installed GNU make, GCC, bash and friends!)
+
+***************************************************************
+
+EOF
+}
+
+
+echo -e "Determining H316 root directory."
+if [ ! -f bin/asm ]; then
+    echo "Error! This script MUST be run from H316 root directory!"
+    exit 1
+fi
+H316=$PWD
+echo -e "H316 root directory is: $H316.\n"
+
+echo -e "Generating SIMH simulator settings."
+
+search_simh=yes
+while [ ! "$simh_set" ]; do
+
+    if [ "$search_simh" ]; then
+       simh=`which h316`
+    fi
+    search_simh=""
+
+    if [ "$simh" ]; then
+       echo -e "Using SIMH executable: $simh"
+       echo -ne "Is that correct? [Y/n]:"
+       read answer
+       echo
+       if [ "$answer" == "n" ]; then 
+           simh=""
+       else
+           simh_set=$simh
+       fi
+    fi
+    
+    if [ ! "$simh" ]; then
+       echo -ne "Please specify absolute path to \
+SIMH h316 executable:"
+       read simh
+       echo
+       if [ ! -x "$simh" ]; then
+           echo "Error! Not an executable: $simh";
+           simh=""
+       fi
+    fi
+done
+
+echo "Generating simulator symlink:"
+rm -f $H316/bin/h316
+ln -sf $simh_set $H316/bin/h316
+echo -e "$simh_set => $H316/bin/h316\n"
+
+
+write_rc
+#write_script
+good_luck
+exit 0
\ No newline at end of file