diff options
author | Daniel Narvaez <dwnarvaez@gmail.com> | 2012-11-16 09:53:35 (GMT) |
---|---|---|
committer | Daniel Narvaez <dwnarvaez@gmail.com> | 2012-11-16 09:53:35 (GMT) |
commit | 61765e0aaae479b94a3fddd01e4e12eae76bb8da (patch) | |
tree | 4c00c5555c77d70db6bd8cae2768d365d12c6702 | |
parent | 76d6fad87094008bc25e3b4e090fb79631414fec (diff) |
Move the remaining scripts to commands
-rw-r--r-- | .gitignore | 4 | ||||
-rw-r--r-- | Makefile | 22 | ||||
-rw-r--r-- | README | 6 | ||||
-rwxr-xr-x | commands/bug-report | 4 | ||||
-rw-r--r-- | commands/helpers/find-free-display.c (renamed from scripts/find-free-display.c) | 0 | ||||
-rwxr-xr-x | commands/helpers/get-screen-dpi (renamed from scripts/get-screen-dpi) | 0 | ||||
-rw-r--r-- | commands/helpers/list-outputs.c (renamed from scripts/list-outputs.c) | 0 | ||||
-rwxr-xr-x | commands/helpers/run-with-keyring (renamed from scripts/run-with-keyring) | 0 | ||||
-rw-r--r-- | commands/helpers/xinitrc (renamed from scripts/xinitrc) | 24 | ||||
-rwxr-xr-x | commands/run | 43 | ||||
-rwxr-xr-x | commands/run-command | 9 | ||||
-rwxr-xr-x | commands/test (renamed from scripts/run-ui-tests) | 10 | ||||
-rwxr-xr-x | scripts/shell/start-sugar | 40 |
13 files changed, 80 insertions, 82 deletions
@@ -6,6 +6,6 @@ source/ logs/*.log logs/*.tar logs/all-logs.tar.bz2 -scripts/list-outputs -scripts/find-free-display +commands/helpers/list-outputs +commands/helpers/find-free-display config @@ -1,4 +1,3 @@ -SCRIPTS = $(CURDIR)/scripts COMMANDS = $(CURDIR)/commands all: build @@ -6,13 +5,15 @@ all: build XRANDR_LIBS = $(shell pkg-config --libs xrandr x11) X11_LIBS = $(shell pkg-config --libs x11) -scripts/list-outputs: scripts/list-outputs.c - gcc -o scripts/list-outputs scripts/list-outputs.c $(XRANDR_LIBS) +commands/helpers/list-outputs: commands/helpers/list-outputs.c + gcc -o commands/helpers/list-outputs \ + commands/helpers/list-outputs.c $(XRANDR_LIBS) -scripts/find-free-display: scripts/find-free-display.c - gcc -o scripts/find-free-display scripts/find-free-display.c $(X11_LIBS) +commands/helpers/find-free-display: commands/helpers/find-free-display.c + gcc -o commands/helpers/find-free-display \ + commands/helpers/find-free-display.c $(X11_LIBS) -x11-utils: scripts/list-outputs scripts/find-free-display +x11-utils: commands/helpers/list-outputs commands/helpers/find-free-display check-system: $(COMMANDS)/check-system $(ARGS) @@ -21,15 +22,16 @@ build: check-system $(COMMANDS)/build run: x11-utils - $(SCRIPTS)/shell/start-sugar + $(COMMANDS)/run + +run-command: x11-utils + $(COMMANDS)/run-command test: x11-utils - $(SCRIPTS)/run-ui-tests + $(COMMANDS)/test shell: x11-utils @PS1="[sugar-build \W]$$ " \ - PATH=$(PATH):$(SCRIPTS)/shell \ - SUGAR_BUILD_SHELL=yes \ $(COMMANDS)/shell bug-report: @@ -86,9 +86,9 @@ restart sugar). Use --help for more informations about each command. -== Configuration == +== Preferences == -You can set a few options by creating sugar-build/config. Example +You can set a few options by creating sugar-build/prefs. Example OUTPUT=HDMI1 RESOLUTION=1024x768 @@ -114,7 +114,7 @@ PROFILE Sugar supports multiple profiles, so that you can run multiple instances with the same user. You can specify the name of the profile with this option. A random generated one is added to -the config if you are running sugar-build under sugar. +the prefs if you are running sugar-build under sugar. RUN_IN_WINDOW diff --git a/commands/bug-report b/commands/bug-report index 05f02ec..cb60b14 100755 --- a/commands/bug-report +++ b/commands/bug-report @@ -1,7 +1,7 @@ #!/bin/sh -scriptsdir=`dirname "$0"` -rootdir=`dirname "$scriptsdir"` +commandsdir=`dirname "$0"` +rootdir=`dirname "$commandsdir"` buildlogsdir=$rootdir/logs sugarlogsdir=~/.sugar/default/logs tarfile=$buildlogsdir/all-logs.tar.bz2 diff --git a/scripts/find-free-display.c b/commands/helpers/find-free-display.c index 4a07131..4a07131 100644 --- a/scripts/find-free-display.c +++ b/commands/helpers/find-free-display.c diff --git a/scripts/get-screen-dpi b/commands/helpers/get-screen-dpi index 8165920..8165920 100755 --- a/scripts/get-screen-dpi +++ b/commands/helpers/get-screen-dpi diff --git a/scripts/list-outputs.c b/commands/helpers/list-outputs.c index 183258c..183258c 100644 --- a/scripts/list-outputs.c +++ b/commands/helpers/list-outputs.c diff --git a/scripts/run-with-keyring b/commands/helpers/run-with-keyring index 2925d2f..2925d2f 100755 --- a/scripts/run-with-keyring +++ b/commands/helpers/run-with-keyring diff --git a/scripts/xinitrc b/commands/helpers/xinitrc index c0339aa..9cb52c8 100644 --- a/scripts/xinitrc +++ b/commands/helpers/xinitrc @@ -4,26 +4,26 @@ unset GNOME_KEYRING_CONTROL unset GNOME_KEYRING_PID unset SESSION_MANAGER -SCRIPTS_DIR=`dirname "$0"` -ROOT_DIR=`dirname "$SCRIPTS_DIR"` -COMMANDS_DIR=$ROOT_DIR/commands +HELPERS_DIR=`dirname "$0"` +COMMANDS_DIR=`dirname "$HELPERS_DIR"` +ROOT_DIR=`dirname "$COMMANDS_DIR"` if [ ! -z $SUGAR_PROFILE ]; then - grep -q PROFILE $ROOT_DIR/config + grep -q PROFILE $ROOT_DIR/prefs if [ $? -ne 0 ]; then randomstring=`</dev/urandom tr -cd A-Za-z0-9 | head -c10` - echo "PROFILE=$randomstring" >> $ROOT_DIR/config + echo "PROFILE=$randomstring" >> $ROOT_DIR/prefs fi fi -if [ -f $ROOT_DIR/config ]; then - source $ROOT_DIR/config +if [ -f $ROOT_DIR/prefs ]; then + source $ROOT_DIR/prefs fi # Sugar doesn't handle multiple outputs properly. To avoid issues we keep the # first output in the list returned by xrandr and turn off everything else. -OUTPUTS=`$SCRIPTS_DIR/list-outputs` +OUTPUTS=`$HELPERS_DIR/list-outputs` for output in $OUTPUTS do @@ -53,10 +53,6 @@ if [ ! -z $SUGAR_XKBCONFIG ]; then rm $SUGAR_XKBCONFIG fi -RUN_COMMAND="dbus-launch --exit-with-session $SCRIPTS_DIR/run-with-keyring sugar" +RUN_COMMAND="dbus-launch --exit-with-session $HELPERS_DIR/run-with-keyring sugar" -if [ -z $SUGAR_BUILD_SHELL ]; then - $COMMANDS_DIR/run $RUN_COMMAND -else - $RUN_COMMAND -fi +$COMMANDS_DIR/run-command $RUN_COMMAND diff --git a/commands/run b/commands/run index b1f76aa..0b485b5 100755 --- a/commands/run +++ b/commands/run @@ -1,9 +1,40 @@ -#!/usr/bin/python +#!/bin/bash -import common -import sys +commandsdir=`dirname "$0"` +helpersdir=$commandsdir/helpers +rootdir=`dirname "$commandsdir"` +display=`$helpersdir/find-free-display` -from devbot import run +if [ -f $rootdir/config ]; then + source $rootdir/config +fi -common.setup() -run.run(sys.argv[1:]) +if [ -n $SUGAR_DISPLAY ]; then + SUGAR_XKBCONFIG=`mktemp -t sugar-xkbconfig-XXXXXX` + setxkbmap -print > $SUGAR_XKBCONFIG + export SUGAR_XKBCONFIG +fi + +if [ ! -z $SUGAR_PROFILE ]; then + grep -q PROFILE $rootdir/config + if [ $? -eq 1 ]; then + randomstring=`</dev/urandom tr -cd A-Za-z0-9 | head -c10` + echo "PROFILE=$randomstring" >> $ROOT_DIR/config + fi +fi + +if [ -z $DISPLAY ]; then + tty_num=`tty | grep -oE '[0-9]+$'` + x_options="vt$tty_num" + + xinit $helpersdir/xinitrc -- $display $x_options +else + screen_dpi=`$helpersdir/get-screen-dpi` + xephyr_options="-dpi $screen_dpi" + + if [ -z $RUN_IN_WINDOW ]; then + xephyr_options="$xephyr_options -fullscreen" + fi + + xinit $helpersdir/xinitrc -- /usr/bin/Xephyr $display $xephyr_options +fi diff --git a/commands/run-command b/commands/run-command new file mode 100755 index 0000000..b1f76aa --- /dev/null +++ b/commands/run-command @@ -0,0 +1,9 @@ +#!/usr/bin/python + +import common +import sys + +from devbot import run + +common.setup() +run.run(sys.argv[1:]) diff --git a/scripts/run-ui-tests b/commands/test index 5a38fb6..3378691 100755 --- a/scripts/run-ui-tests +++ b/commands/test @@ -1,11 +1,11 @@ #!/bin/sh -scriptsdir=`dirname "$0"` -rootdir=`dirname "$scriptsdir"` +commandsdir=`dirname "$0"` +helpersdir=$commandsdir/helpers +rootdir=`dirname "$helpersdir"` testsdir=$rootdir/tests -scriptsdir=$rootdir/scripts logsdir=$rootdir/logs -display=`$scriptsdir/find-free-display` +display=`$helpersdir/find-free-display` resolution=1024x768x16 xvfb=`which Xvfb` @@ -19,7 +19,7 @@ export SUGAR_LOGGER_LEVEL=debug export GTK_MODULES=gail:atk-bridge export SUGAR_UI_TESTS=yes -xinit $scriptsdir/xinitrc -- $xserver & +xinit $helpersdir/xinitrc -- $xserver & xinitpid=$! sleep 5 diff --git a/scripts/shell/start-sugar b/scripts/shell/start-sugar deleted file mode 100755 index 5f5d3d4..0000000 --- a/scripts/shell/start-sugar +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/bash - -shelldir=`dirname "$0"` -scriptsdir=`dirname "$shelldir"` -rootdir=`dirname "$scriptsdir"` -display=`$scriptsdir/find-free-display` - -if [ -f $rootdir/config ]; then - source $rootdir/config -fi - -if [ -n $SUGAR_DISPLAY ]; then - SUGAR_XKBCONFIG=`mktemp -t sugar-xkbconfig-XXXXXX` - setxkbmap -print > $SUGAR_XKBCONFIG - export SUGAR_XKBCONFIG -fi - -if [ ! -z $SUGAR_PROFILE ]; then - grep -q PROFILE $rootdir/config - if [ $? -eq 1 ]; then - randomstring=`</dev/urandom tr -cd A-Za-z0-9 | head -c10` - echo "PROFILE=$randomstring" >> $ROOT_DIR/config - fi -fi - -if [ -z $DISPLAY ]; then - tty_num=`tty | grep -oE '[0-9]+$'` - x_options="vt$tty_num" - - xinit $scriptsdir/xinitrc -- $display $x_options -else - screen_dpi=`$scriptsdir/get-screen-dpi` - xephyr_options="-dpi $screen_dpi" - - if [ -z $RUN_IN_WINDOW ]; then - xephyr_options="$xephyr_options -fullscreen" - fi - - xinit $scriptsdir/xinitrc -- /usr/bin/Xephyr $display $xephyr_options -fi |