diff options
Diffstat (limited to 'bin')
-rw-r--r-- | bin/Makefile.am | 13 | ||||
-rw-r--r-- | bin/Makefile.in | 448 | ||||
-rw-r--r-- | bin/sugar-control-panel | 28 | ||||
-rwxr-xr-x | bin/sugar-emulator | 14 | ||||
-rw-r--r-- | bin/sugar-install-bundle | 20 | ||||
-rw-r--r-- | bin/sugar-launch | 89 | ||||
-rwxr-xr-x | bin/sugar-session | 293 | ||||
-rw-r--r-- | bin/sugar-ui-check | 161 | ||||
-rw-r--r-- | bin/sugar.in | 82 |
9 files changed, 1148 insertions, 0 deletions
diff --git a/bin/Makefile.am b/bin/Makefile.am new file mode 100644 index 0000000..8fc5692 --- /dev/null +++ b/bin/Makefile.am @@ -0,0 +1,13 @@ +python_scripts = \ + sugar-control-panel \ + sugar-emulator \ + sugar-install-bundle \ + sugar-launch \ + sugar-session \ + sugar-ui-check + +bin_SCRIPTS = \ + sugar \ + $(python_scripts) + +EXTRA_DIST = $(python_scripts) sugar.in diff --git a/bin/Makefile.in b/bin/Makefile.in new file mode 100644 index 0000000..7035d24 --- /dev/null +++ b/bin/Makefile.in @@ -0,0 +1,448 @@ +# Makefile.in generated by automake 1.11.3 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +subdir = bin +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(srcdir)/sugar.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_CLEAN_FILES = sugar +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(bindir)" +SCRIPTS = $(bin_SCRIPTS) +SOURCES = +DIST_SOURCES = +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALL_LINGUAS = @ALL_LINGUAS@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CATALOGS = @CATALOGS@ +CATOBJEXT = @CATOBJEXT@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DATADIRNAME = @DATADIRNAME@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GCONFTOOL = @GCONFTOOL@ +GCONF_SCHEMA_CONFIG_SOURCE = @GCONF_SCHEMA_CONFIG_SOURCE@ +GCONF_SCHEMA_FILE_DIR = @GCONF_SCHEMA_FILE_DIR@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GMOFILES = @GMOFILES@ +GMSGFMT = @GMSGFMT@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INSTOBJEXT = @INSTOBJEXT@ +INTLLIBS = @INTLLIBS@ +INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ +INTLTOOL_MERGE = @INTLTOOL_MERGE@ +INTLTOOL_PERL = @INTLTOOL_PERL@ +INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ +INTLTOOL_V_MERGE = @INTLTOOL_V_MERGE@ +INTLTOOL_V_MERGE_OPTIONS = @INTLTOOL_V_MERGE_OPTIONS@ +INTLTOOL__v_MERGE_ = @INTLTOOL__v_MERGE_@ +INTLTOOL__v_MERGE_0 = @INTLTOOL__v_MERGE_0@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +MSGFMT = @MSGFMT@ +MSGFMT_OPTS = @MSGFMT_OPTS@ +MSGMERGE = @MSGMERGE@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POFILES = @POFILES@ +POSUB = @POSUB@ +PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ +PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ +PYTHON = @PYTHON@ +PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ +PYTHON_PLATFORM = @PYTHON_PLATFORM@ +PYTHON_PREFIX = @PYTHON_PREFIX@ +PYTHON_VERSION = @PYTHON_VERSION@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SHELL_CFLAGS = @SHELL_CFLAGS@ +SHELL_LIBS = @SHELL_LIBS@ +STRIP = @STRIP@ +SUCROSE_VERSION = @SUCROSE_VERSION@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +XGETTEXT = @XGETTEXT@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build_alias = @build_alias@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host_alias = @host_alias@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +intltool__v_merge_options_ = @intltool__v_merge_options_@ +intltool__v_merge_options_0 = @intltool__v_merge_options_0@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +pkgpyexecdir = @pkgpyexecdir@ +pkgpythondir = @pkgpythondir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +pyexecdir = @pyexecdir@ +pythondir = @pythondir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +python_scripts = \ + sugar-control-panel \ + sugar-emulator \ + sugar-install-bundle \ + sugar-launch \ + sugar-session \ + sugar-ui-check + +bin_SCRIPTS = \ + sugar \ + $(python_scripts) + +EXTRA_DIST = $(python_scripts) sugar.in +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign bin/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign bin/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +sugar: $(top_builddir)/config.status $(srcdir)/sugar.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +install-binSCRIPTS: $(bin_SCRIPTS) + @$(NORMAL_INSTALL) + test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" + @list='$(bin_SCRIPTS)'; test -n "$(bindir)" || list=; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n' \ + -e 'h;s|.*|.|' \ + -e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) { files[d] = files[d] " " $$1; \ + if (++n[d] == $(am__install_max)) { \ + print "f", d, files[d]; n[d] = 0; files[d] = "" } } \ + else { print "f", d "/" $$4, $$1 } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(bindir)$$dir'"; \ + $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ + } \ + ; done + +uninstall-binSCRIPTS: + @$(NORMAL_UNINSTALL) + @list='$(bin_SCRIPTS)'; test -n "$(bindir)" || exit 0; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 's,.*/,,;$(transform)'`; \ + dir='$(DESTDIR)$(bindir)'; $(am__uninstall_files_from_dir) +tags: TAGS +TAGS: + +ctags: CTAGS +CTAGS: + + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(SCRIPTS) +installdirs: + for dir in "$(DESTDIR)$(bindir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-binSCRIPTS + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-binSCRIPTS + +.MAKE: install-am install-strip + +.PHONY: all all-am check check-am clean clean-generic distclean \ + distclean-generic distdir dvi dvi-am html html-am info info-am \ + install install-am install-binSCRIPTS install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic pdf \ + pdf-am ps ps-am uninstall uninstall-am uninstall-binSCRIPTS + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/bin/sugar-control-panel b/bin/sugar-control-panel new file mode 100644 index 0000000..a97e3c0 --- /dev/null +++ b/bin/sugar-control-panel @@ -0,0 +1,28 @@ +#!/usr/bin/env python +# Copyright (C) 2008, Red Hat, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +import sys + +from jarabe import config + +sys.path.append(config.ext_path) + +from jarabe.controlpanel.cmd import main + +main() + + diff --git a/bin/sugar-emulator b/bin/sugar-emulator new file mode 100755 index 0000000..308aac7 --- /dev/null +++ b/bin/sugar-emulator @@ -0,0 +1,14 @@ +#!/bin/sh + +if [ "$(id -u)" -eq 0 -o "$(id -ru)" -eq 0 ] ; then + echo Refusing to run as root. + exit 3 +fi + +# Source debug definitions +if [ -f ~/.sugar/debug ]; then + . ~/.sugar/debug +fi + +# Start emulator +python -c "import sys; from jarabe.util import emulator; sys.argv[0]='$0'; emulator.main()" "$@" diff --git a/bin/sugar-install-bundle b/bin/sugar-install-bundle new file mode 100644 index 0000000..52deada --- /dev/null +++ b/bin/sugar-install-bundle @@ -0,0 +1,20 @@ +#!/usr/bin/env python +import sys + +from sugar.bundle.activitybundle import ActivityBundle + +from dbus.mainloop.glib import DBusGMainLoop +DBusGMainLoop(set_as_default=True) + +def cmd_help(): + print 'Usage: sugar-install-bundle [ bundlename ] \n\n\ + Install an activity bundle (.xo). \n' + +if len(sys.argv) != 2: + cmd_help() + sys.exit(2) + +bundle = ActivityBundle(sys.argv[1]) +bundle.install() + +print "%s: '%s' installed." % (sys.argv[0], sys.argv[1]) diff --git a/bin/sugar-launch b/bin/sugar-launch new file mode 100644 index 0000000..7297a8e --- /dev/null +++ b/bin/sugar-launch @@ -0,0 +1,89 @@ +#!/usr/bin/env python + +# Copyright (C) 2007, Red Hat, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +import os +import sys +import dbus +from optparse import OptionParser + +from sugar.activity import activityfactory +from sugar.bundle.activitybundle import ActivityBundle + +usage = "usage: %prog [options] activity" +parser = OptionParser(usage) +parser.add_option("-d", "--debug", action="store_true", dest="debug", + help="launch activity inside gdb") +(options, args) = parser.parse_args() + +if len(args) == 0: + print 'You need to specify the activity bundle_id.' + sys.exit(1) + +bus = dbus.SessionBus() +proxy = bus.get_object('org.laptop.Shell', '/org/laptop/Shell') +path = dbus.Interface(proxy, 'org.laptop.Shell').GetBundlePath(args[0]) +if not path: + print 'Cannot find %s bundle.' % args[0] + sys.exit(1) + +activity = ActivityBundle(path) +cmd_args = activityfactory.get_command(activity) + +def _which(exec_file): + if 'PATH' in os.environ: + envpath = os.environ['PATH'] + else: + return None + + for path in envpath.split(os.pathsep): + fullname = os.path.join(path, exec_file) + if os.path.exists(fullname): + return fullname + + return None + +def _get_interpreter(exec_file): + if os.path.exists(exec_file): + abs_path = exec_file + else: + abs_path = _which(exec_file) + if not abs_path: + return exec_file + + f = open(abs_path) + line = f.readline(100) + if line.startswith('#!'): + cmds = line[2:].strip().split(' ') + cmds.append(abs_path) + + if '/usr/bin/env' in cmds: + cmds.remove('/usr/bin/env') + + return cmds + + return exec_file + +if options.debug: + act_args = cmd_args + cmd_args = ['gdb', '--args'] + cmd_args.extend(_get_interpreter(act_args.pop(0))) + cmd_args.extend(act_args) + +os.chdir(str(activity.get_path())) +os.execvpe(cmd_args[0], cmd_args, activityfactory.get_environment(activity)) + diff --git a/bin/sugar-session b/bin/sugar-session new file mode 100755 index 0000000..e9c8d50 --- /dev/null +++ b/bin/sugar-session @@ -0,0 +1,293 @@ +#!/usr/bin/env python +# Copyright (C) 2006, Red Hat, Inc. +# Copyright (C) 2009, One Laptop Per Child Association Inc +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +import os +import sys +import time +import subprocess +import shutil + +if os.environ.get('SUGAR_LOGGER_LEVEL', '') == 'debug': + print '%r STARTUP: Starting the shell' % time.time() + sys.stdout.flush() + +import gettext +import logging + +import gconf +import gtk +import gobject +import dbus.glib +import wnck + +try: + import xklavier +except ImportError: + logging.debug('Could not load xklavier for keyboard configuration') + +gtk.gdk.threads_init() +dbus.glib.threads_init() + +def cleanup_logs(logs_dir): + """Clean up the log directory, moving old logs into a numbered backup + directory. We only keep `_MAX_BACKUP_DIRS` of these backup directories + around; the rest are removed.""" + if not os.path.isdir(logs_dir): + os.makedirs(logs_dir) + + backup_logs = [] + backup_dirs = [] + for f in os.listdir(logs_dir): + path = os.path.join(logs_dir, f) + if os.path.isfile(path): + backup_logs.append(f) + elif os.path.isdir(path): + backup_dirs.append(path) + + if len(backup_dirs) > 3: + backup_dirs.sort() + root = backup_dirs[0] + for f in os.listdir(root): + os.remove(os.path.join(root, f)) + os.rmdir(root) + + if len(backup_logs) > 0: + name = str(int(time.time())) + backup_dir = os.path.join(logs_dir, name) + os.mkdir(backup_dir) + for log in backup_logs: + source_path = os.path.join(logs_dir, log) + dest_path = os.path.join(backup_dir, log) + os.rename(source_path, dest_path) + +def start_ui_service(): + from jarabe.view.service import UIService + + ui_service = UIService() + +def start_session_manager(): + from jarabe.model.session import get_session_manager + + session_manager = get_session_manager() + session_manager.start() + +def unfreeze_dcon_cb(): + logging.debug('STARTUP: unfreeze_dcon_cb') + from jarabe.model import screen + + screen.set_dcon_freeze(0) + +def setup_frame_cb(): + logging.debug('STARTUP: setup_frame_cb') + from jarabe import frame + frame.get_view() + +def setup_keyhandler_cb(): + logging.debug('STARTUP: setup_keyhandler_cb') + from jarabe.view import keyhandler + from jarabe import frame + keyhandler.setup(frame.get_view()) + +def setup_journal_cb(): + logging.debug('STARTUP: setup_journal_cb') + from jarabe.journal import journalactivity + journalactivity.start() + +def show_software_updates_cb(): + logging.debug('STARTUP: show_software_updates_cb') + if os.path.isfile(os.path.expanduser('~/.sugar-update')): + from jarabe.desktop import homewindow + home_window = homewindow.get_instance() + home_window.get_home_box().show_software_updates_alert() + +def setup_notification_service_cb(): + from jarabe.model import notifications + notifications.init() + +def setup_file_transfer_cb(): + from jarabe.model import filetransfer + filetransfer.init() + +def setup_keyboard_cb(): + logging.debug('STARTUP: setup_keyboard_cb') + + gconf_client = gconf.client_get_default() + have_config = False + + try: + display = gtk.gdk.display_get_default() + if display is not None: + engine = xklavier.Engine(display) + else: + logging.debug('setup_keyboard_cb: Could not get default display.') + return + + configrec = xklavier.ConfigRec() + configrec.get_from_server(engine) + + layouts = gconf_client.get_list(\ + '/desktop/sugar/peripherals/keyboard/layouts', gconf.VALUE_STRING) + layouts_list = [] + variants_list = [] + for layout in layouts: + layouts_list.append(layout.split('(')[0]) + variants_list.append(layout.split('(')[1][:-1]) + + if layouts_list and variants_list: + have_config = True + configrec.set_layouts(layouts_list) + configrec.set_variants(variants_list) + + model = gconf_client.get_string(\ + '/desktop/sugar/peripherals/keyboard/model') + if model: + have_config = True + configrec.set_model(model) + + options = gconf_client.get_list(\ + '/desktop/sugar/peripherals/keyboard/options', gconf.VALUE_STRING) + if options: + have_config = True + configrec.set_options(options) + + if have_config: + configrec.activate(engine) + except Exception: + logging.exception('Error during keyboard configuration') + +def setup_window_manager(): + logging.debug('STARTUP: window_manager') + + # have to reset cursor(metacity sets it on startup) + if subprocess.call('echo $DISPLAY; xsetroot -cursor_name left_ptr', shell=True): + logging.warning('Can not reset cursor') + + if subprocess.call('metacity-message disable-keybindings', + shell=True): + logging.warning('Can not disable metacity keybindings') + + if subprocess.call('metacity-message disable-mouse-button-modifiers', + shell=True): + logging.warning('Can not disable metacity mouse button modifiers') + +def bootstrap(): + setup_window_manager() + + from jarabe.view import launcher + launcher.setup() + + gobject.idle_add(setup_frame_cb) + gobject.idle_add(setup_keyhandler_cb) + gobject.idle_add(setup_journal_cb) + gobject.idle_add(setup_notification_service_cb) + gobject.idle_add(setup_file_transfer_cb) + gobject.idle_add(show_software_updates_cb) + + if sys.modules.has_key('xklavier'): + gobject.idle_add(setup_keyboard_cb) + +def set_fonts(): + client = gconf.client_get_default() + face = client.get_string('/desktop/sugar/font/default_face') + size = client.get_float('/desktop/sugar/font/default_size') + settings = gtk.settings_get_default() + settings.set_property("gtk-font-name", "%s %f" % (face, size)) + +def main(): + try: + from sugar import env + # Remove temporary files. See http://bugs.sugarlabs.org/ticket/1876 + data_dir = os.path.join(env.get_profile_path(), 'data') + shutil.rmtree(data_dir, ignore_errors=True) + os.makedirs(data_dir) + cleanup_logs(env.get_logs_path()) + except OSError, e: + # logs cleanup is not critical; it should not prevent sugar from + # starting if (for example) the disk is full or read-only. + print 'logs cleanup failed: %s' % e + + from sugar import logger + # NOTE: This needs to happen so early because some modules register translatable + # strings in the module scope. + from jarabe import config + gettext.bindtextdomain('sugar', config.locale_path) + gettext.bindtextdomain('sugar-toolkit', config.locale_path) + gettext.textdomain('sugar') + + from jarabe.desktop import homewindow + from jarabe.model import sound + from jarabe import intro + + logger.start('shell') + + client = gconf.client_get_default() + client.set_string('/apps/metacity/general/mouse_button_modifier', + '<Super>') + + timezone = client.get_string('/desktop/sugar/date/timezone') + if timezone is not None and timezone: + os.environ['TZ'] = timezone + + set_fonts() + + # this must be added early, so that it executes and unfreezes the screen + # even when we initially get blocked on the intro screen + gobject.idle_add(unfreeze_dcon_cb) + + # make sure we have the correct cursor in the intro screen + # TODO #3204 + if subprocess.call('echo $DISPLAY; xsetroot -cursor_name left_ptr', shell=True): + logging.warning('Can not reset cursor') + intro.check_profile() + + start_ui_service() + start_session_manager() + + sound.restore() + + sys.path.append(config.ext_path) + + icons_path = os.path.join(config.data_path, 'icons') + gtk.icon_theme_get_default().append_search_path(icons_path) + + # open homewindow before window_manager to let desktop appear fast + home_window = homewindow.get_instance() + home_window.show() + + screen = wnck.screen_get_default() + screen.connect('window-manager-changed', __window_manager_changed_cb) + _check_for_window_manager(screen) + + try: + gtk.main() + except KeyboardInterrupt: + print 'Ctrl+C pressed, exiting...' + + +def __window_manager_changed_cb(screen): + _check_for_window_manager(screen) + + +def _check_for_window_manager(screen): + wm_name = screen.get_window_manager_name() + if wm_name is not None: + screen.disconnect_by_func(__window_manager_changed_cb) + bootstrap() + + +main() diff --git a/bin/sugar-ui-check b/bin/sugar-ui-check new file mode 100644 index 0000000..4d71796 --- /dev/null +++ b/bin/sugar-ui-check @@ -0,0 +1,161 @@ +#!/usr/bin/env python +# Copyright (C) 2008, Red Hat, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +import logging +import os +import sys +import subprocess +import time + +import dbus +import gobject +import gtk +import wnck + +from sugar import wm + +from jarabe.model.shell import get_sugar_window_type +from sugar.bundle.activitybundle import ActivityBundle +from jarabe import config + +checks_queue = [] +checks_failed = [] +checks_succeeded = [] + +def get_dbus_version(): + p = subprocess.Popen(['dbus-daemon', '--version'], stdout=subprocess.PIPE) + + output = p.communicate()[0] + first_line = output.split('\n')[0] + + return first_line.split(' ')[-1] + +class Check(object): + def __init__(self): + self.name = None + self.succeeded = False + self.start_time = None + self.max_time = None + self.timeout = None + + def start(self): + logging.info('Start %s check.' % self.name) + + self.start_time = time.time() + + def get_failed(self): + if self.max_time and self.start_time: + if time.time() - self.start_time > self.max_time: + return True + return False + + failed = property(get_failed) + +class ShellCheck(Check): + def __init__(self): + Check.__init__(self) + + self.name = 'Shell' + self.max_time = 30 + + def start(self): + Check.start(self) + + screen = wnck.screen_get_default() + screen.connect('window-opened', self._window_opened_cb) + + def _window_opened_cb(self, screen, window): + if window.get_window_type() == wnck.WINDOW_DESKTOP: + self.succeeded = True + +class ActivityCheck(Check): + def __init__(self, bundle_id): + Check.__init__(self) + + self.name = bundle_id + self.max_time = 120 + + def start(self): + Check.start(self) + + self.launch_activity() + + screen = wnck.screen_get_default() + screen.connect('window-opened', self._window_opened_cb) + + def launch_activity(self): + from sugar.activity import activityfactory + + bus = dbus.SessionBus() + proxy = bus.get_object('org.laptop.Shell', '/org/laptop/Shell') + iface = dbus.Interface(proxy, 'org.laptop.Shell') + path = iface.GetBundlePath(self.name) + + if path: + activityfactory.create(ActivityBundle(path)) + else: + logging.error('Cannot find activity %s.' % self.name) + + def _window_opened_cb(self, screen, window): + if wm.get_bundle_id(window) == self.name and \ + get_sugar_window_type(window) != 'launcher': + self.succeeded = True + +def _timeout_cb(): + check = checks_queue[0] + if check.failed: + logging.info('%s check failed.' % (check.name)) + checks_failed.append(checks_queue.pop(0)) + elif check.succeeded: + logging.info('%s check succeeded.' % (check.name)) + checks_succeeded.append(checks_queue.pop(0)) + else: + return True + + if len(checks_queue) > 0: + checks_queue[0].start() + else: + gtk.main_quit() + + return True + +def main(): + os.environ['GTK2_RC_FILES'] = os.path.join(config.data_path, 'sugar-100.gtkrc') + + logging.basicConfig(level=logging.INFO, + format='%(asctime)s %(levelname)s %(message)s') + + checks_queue.append(ShellCheck()) + + if get_dbus_version() >= '1.2.1': + # FIXME needs to get a list of the installed activities + checks_queue.append(ActivityCheck('org.laptop.Log')) + checks_queue.append(ActivityCheck('org.laptop.Chat')) + checks_queue.append(ActivityCheck('org.laptop.WebActivity')) + checks_queue.append(ActivityCheck('org.laptop.Pippy')) + checks_queue.append(ActivityCheck('org.laptop.Terminal')) + checks_queue.append(ActivityCheck('org.laptop.AbiWordActivity')) + + checks_queue[0].start() + gobject.timeout_add(500, _timeout_cb) + + gtk.main() + + if len(checks_failed) > 0: + sys.exit(1) + +main() diff --git a/bin/sugar.in b/bin/sugar.in new file mode 100644 index 0000000..12098db --- /dev/null +++ b/bin/sugar.in @@ -0,0 +1,82 @@ +#!/bin/sh + +if [ "$(id -u)" -eq 0 -o "$(id -ru)" -eq 0 ] ; then + echo Refusing to run as root. + exit 3 +fi + +usage() { + cat <<EOF +Usage: sugar [OPTION].. + +Start Sugar window manager. + +Optional arguments. + -d, --display DISPLAY Display to start sugar + -s, --scaling SCALING Scale Sugar theme + Supported values: 72, 100 +EOF + exit 0 +} + +while [ $# -ne 0 ] ; do + case "$1" in + -d | --display) + shift + export DISPLAY="$1" + ;; + -s | --scaling) + shift + export SUGAR_SCALING="$1" + ;; + -h | --help) + usage + ;; + esac + shift +done + +# Set default profile dir +if test -z "$SUGAR_PROFILE"; then + export SUGAR_PROFILE=default +fi + +if test -z "$SUGAR_SCALING"; then + export SUGAR_SCALING=72 +fi + +export GTK2_RC_FILES="@prefix@/share/sugar/data/sugar-$SUGAR_SCALING.gtkrc" + +# Needed for executing wpa_passphrase +export PATH="$PATH":/sbin:/usr/sbin + +if ! test -f "$GTK2_RC_FILES"; then + echo "sugar: ERROR: Gtk theme for scaling $SUGAR_SCALING not available in path $GTK2_RC_FILES" + exit 1 +fi + +# Set default language +export LANG="${LANG:-en_US.utf8}" +export LANGUAGE="${LANGUAGE:-${LANG}}" + +# Set Sugar's telepathy accounts directory +export MC_ACCOUNT_DIR=$HOME/.sugar/$SUGAR_PROFILE/accounts + +# Workaround until gnome-keyring-daemon lets dbus activate it +# https://bugzilla.gnome.org/show_bug.cgi?id=628302 +if test "$SUGAR_EMULATOR" = "yes" -a "$(type gnome-keyring-daemon)"; then + gnome-keyring-daemon --components=secrets & +fi + +# Source language settings and debug definitions +if [ -f ~/.i18n ]; then + . ~/.i18n +fi +if [ -f ~/.sugar/debug ]; then + . ~/.sugar/debug +fi + +echo Xcursor.theme: sugar | xrdb -merge +metacity --no-force-fullscreen -d $DISPLAY & + +exec sugar-session |