From 67914890f764b0fa8d597ec6d8bae9ec883bb596 Mon Sep 17 00:00:00 2001 From: bjschuma Date: Mon, 21 Dec 2009 19:28:16 -0500 Subject: [PATCH] Made installer, which creates an uninstaller in the /opt/scion directory --- src/base/settings.py | 20 +++++--------------- src/core/cli.py | 1 - src/core/cline/loop.py | 2 +- src/core/cline/message.py | 4 ++-- src/core/cline/run.py | 4 +++- src/install.sh | 19 +++++++++++++++++++ src/scion | 2 +- 7 files changed, 31 insertions(+), 21 deletions(-) create mode 100644 src/install.sh diff --git a/src/base/settings.py b/src/base/settings.py index 9386fcd7..faa52efd 100644 --- a/src/base/settings.py +++ b/src/base/settings.py @@ -31,28 +31,18 @@ from bt.file import fopen # Return the value at key def get(key, all=False): + global settings if(all == False): return settings[key.upper()][0] else: - return settings[key.upper()] + return settings[key.upper()] -#def replace(key,value): -# global settings -# if (key in settings) == True: -# del settings[key] -# set(key,value) - - -def pop(key): +def replace(key,value): global settings - value = None if (key in settings) == True: - values = settings[key] - if len(values) > 0: - value = values.pop(0) - return value - + del settings[key] + set(key,value) # Read settings from file diff --git a/src/core/cli.py b/src/core/cli.py index b785c917..f73e0e3b 100644 --- a/src/core/cli.py +++ b/src/core/cli.py @@ -10,7 +10,6 @@ app = "scion" type = "core" path = "" opt = [] - import curses from bt.message import * #from bt.needle import Needle diff --git a/src/core/cline/loop.py b/src/core/cline/loop.py index eb8cee59..7d6538fb 100644 --- a/src/core/cline/loop.py +++ b/src/core/cline/loop.py @@ -25,7 +25,7 @@ def loop(): write("Beginning command line loop",True) global halt - #stdscr = settings.get("stdscr") + stdscr = settings.get("stdscr") input = settings.get("prompt") (y, x) = settings.get("stdscr").getyx() disp(input) diff --git a/src/core/cline/message.py b/src/core/cline/message.py index 5015bd41..f8e97796 100644 --- a/src/core/cline/message.py +++ b/src/core/cline/message.py @@ -12,9 +12,9 @@ import settings # Add string to line y def insert(string): stdscr = settings.get("stdscr") - y = settings.pop("cliney") + y = settings.get("cliney") y+=1 - settings.set("cliney", y) + settings.replace("cliney", y) stdscr.addstr(y, 0, string) diff --git a/src/core/cline/run.py b/src/core/cline/run.py index ba794b5e..19e7c8ec 100644 --- a/src/core/cline/run.py +++ b/src/core/cline/run.py @@ -21,5 +21,7 @@ def run(input): manager.run(input) y = settings.get("cliney") - settings.replace("cliney", y+1) + y+=1 + settings.replace("cliney", y) + return prompt diff --git a/src/install.sh b/src/install.sh new file mode 100644 index 00000000..ef247508 --- /dev/null +++ b/src/install.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +mkdir /opt/scion +rsync -avz --progress base /opt/scion/ +rsync -avz --progress core /opt/scion/ + +FILE="/usr/bin/scion" +touch $FILE +echo "#!/bin/bash" > $FILE +echo "cd /opt/scion/base && \`which python\` scion.py \$\*" >> $FILE + +chmod +x $FILE + + +UNINSTALL="/opt/scion/uninstall.sh" +touch $UNINSTALL +echo "#!/bin/bash" > $UNINSTALL +echo "cd /opt/ && rm -r scion" >> $UNINSTALL +echo "rm /usr/bin/scion" >> $UNINSTALL diff --git a/src/scion b/src/scion index 0bbee9aa..2bb3babc 100755 --- a/src/scion +++ b/src/scion @@ -1,4 +1,4 @@ #!/bin/bash # This is a simple shell script for properly starting ocarina -cd base && `which python` scion.py $* \ No newline at end of file +cd /opt/scion/base && `which python` scion.py $* \ No newline at end of file