This is an example to launch Window Maker using a script.
--
||// //\\// Rodolfo "kix" Garcia
||\\// //\\ http://www.kix.es/
>From df759ae5d2c4a39999ea45bc478d504eb5f0015c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?"Rodolfo=20Garc=C3=ADa=20Pe=C3=B1as=20(kix)"?= <[email protected]>
Date: Sat, 25 Feb 2012 17:29:38 +0100
Subject: [PATCH] WindowMaker: Lauch script
Now Window Maker uses a script (wmaker) to lauch the binary (wmaker.real).
---
debian/debianfiles/wmaker | 76 ------------------------------------------
debian/wmaker-common.install | 2 +-
debian/wmaker.install | 34 +++----------------
src/Makefile.am | 8 ++--
util/Makefile.am | 16 +++++++--
util/wmaker.in | 76 ++++++++++++++++++++++++++++++++++++++++++
6 files changed, 99 insertions(+), 113 deletions(-)
delete mode 100644 debian/debianfiles/wmaker
create mode 100644 util/wmaker.in
diff --git a/debian/debianfiles/wmaker b/debian/debianfiles/wmaker
deleted file mode 100644
index 8317563..0000000
--- a/debian/debianfiles/wmaker
+++ /dev/null
@@ -1,76 +0,0 @@
-#!/bin/sh
-
-set -e
-
-[ -n "$GNUSTEP_USER_ROOT" ] || export GNUSTEP_USER_ROOT="$HOME/GNUstep"
-gs_base="$GNUSTEP_USER_ROOT"
-gs_defaults="$gs_base/Defaults"
-gs_system_defaults=/etc/GNUstep/Defaults
-wm_base="$gs_base/Library/WindowMaker"
-wm_backgrounds="$wm_base/Backgrounds"
-wm_iconsets="$wm_base/IconSets"
-wm_pixmaps="$wm_base/Pixmaps"
-gs_icons="$gs_base/Library/Icons"
-wm_style="$wm_base/Style"
-wm_styles="$wm_base/Styles"
-wm_themes="$wm_base/Themes"
-WindowMaker=/usr/lib/WindowMaker/wmaker
-convertfonts=/usr/lib/WindowMaker/convertfonts
-
-make_dir_if_needed ()
-{
- if [ ! -d "$1" ] ; then
- install -m 0755 -d "$1"
- fi
-}
-
-rename_dir_if_possible ()
-{
- if [ ! -d "$2" ] ; then
- if [ -d "$1" ] ; then
- mv "$1" "$2"
- fi
- fi
-}
-
-copy_defaults_if_needed ()
-{
- file="$gs_defaults/$1"
- system_file="$gs_system_defaults/$1"
- if [ ! -f "$file" ] ; then
- install -m 0644 "$system_file" "$file"
- fi
-}
-
-make_dir_if_needed "$gs_defaults"
-make_dir_if_needed "$wm_base"
-make_dir_if_needed "$wm_backgrounds"
-make_dir_if_needed "$wm_iconsets"
-make_dir_if_needed "$wm_pixmaps"
-make_dir_if_needed "$gs_icons"
-rename_dir_if_possible "$wm_style" "$wm_styles"
-make_dir_if_needed "$wm_styles"
-make_dir_if_needed "$wm_themes"
-
-copy_defaults_if_needed WindowMaker
-copy_defaults_if_needed WMRootMenu
-copy_defaults_if_needed WMState
-#copy_defaults_if_needed WMWindowAttributes
-
-if [ -x $convertfonts -a ! -e "$wm_base/.fonts_converted" ] ; then
-# --keep-xlfd is used in order to preserve the original information
- $convertfonts --keep-xlfd "$gs_defaults/WindowMaker"
- if [ -f "$gs_defaults/WMGLOBAL" ] ; then
- $convertfonts --keep-xlfd "$gs_defaults/WMGLOBAL"
- fi
- find "$wm_styles" -type f -print0 -mindepth 1 -maxdepth 1 |
- xargs -0 -r -n 1 $convertfonts --keep-xlfd
- touch "$wm_base/.fonts_converted"
-fi
-
-if [ -n "$1" -a -x "$WindowMaker$1" ] ; then
- WindowMaker="$WindowMaker$1"
- shift
-fi
-
-exec "$WindowMaker" "$@"
diff --git a/debian/wmaker-common.install b/debian/wmaker-common.install
index 0e71c16..b9590f1 100644
--- a/debian/wmaker-common.install
+++ b/debian/wmaker-common.install
@@ -126,7 +126,7 @@ usr/share/lib/GNUstep/System/Applications/WPrefs.app/WPrefs.xpm
usr/share/lib/GNUstep/System/Applications/WPrefs.app/WPrefs.tiff
usr/share/lib/GNUstep/System/Applications/WPrefs.app/tiff/*.tiff
# Scripts
-debian/debianfiles/wmaker usr/bin
+usr/bin/wmaker
debian/debianfiles/upgrade-windowmaker-defaults usr/sbin
# Theme
debian/debianfiles/Theme/Debian usr/share/WindowMaker/Themes
diff --git a/debian/wmaker.install b/debian/wmaker.install
index 265bb4e..b34237e 100644
--- a/debian/wmaker.install
+++ b/debian/wmaker.install
@@ -10,34 +10,10 @@ usr/bin/seticons
usr/bin/geticonset
usr/bin/setstyle
usr/bin/wxpaste
-usr/bin/wmaker usr/lib/WindowMaker
-usr/bin/convertfonts usr/lib/WindowMaker
+usr/bin/wmaker.real
+usr/bin/convertfonts
usr/share/lib/GNUstep/System/Applications/WPrefs.app/WPrefs usr/lib/GNUstep/System/Applications/WPrefs.app
# Manpages - Locale specific
-usr/share/man/ru/man1/wxpaste.1x
-usr/share/man/ru/man1/geticonset.1x
-usr/share/man/ru/man1/seticons.1x
-usr/share/man/ru/man1/setstyle.1x
-usr/share/man/ru/man1/getstyle.1x
-usr/share/man/ru/man1/wdwrite.1x
-usr/share/man/ru/man1/wxcopy.1x
-usr/share/man/ru/man1/wmaker.1x
-usr/share/man/ru/man1/wmsetbg.1x
-usr/share/man/sk/man1/wxpaste.1x
-usr/share/man/sk/man1/geticonset.1x
-usr/share/man/sk/man1/seticons.1x
-usr/share/man/sk/man1/setstyle.1x
-usr/share/man/sk/man1/getstyle.1x
-usr/share/man/sk/man1/wdwrite.1x
-usr/share/man/sk/man1/wxcopy.1x
-usr/share/man/sk/man1/wmaker.1x
-usr/share/man/sk/man1/wmsetbg.1x
-usr/share/man/cs/man1/wxpaste.1x
-usr/share/man/cs/man1/geticonset.1x
-usr/share/man/cs/man1/seticons.1x
-usr/share/man/cs/man1/setstyle.1x
-usr/share/man/cs/man1/getstyle.1x
-usr/share/man/cs/man1/wdwrite.1x
-usr/share/man/cs/man1/wxcopy.1x
-usr/share/man/cs/man1/wmaker.1x
-usr/share/man/cs/man1/wmsetbg.1x
+usr/share/man/ru/man1/*.1x
+usr/share/man/sk/man1/*.1x
+usr/share/man/cs/man1/*.1x
diff --git a/src/Makefile.am b/src/Makefile.am
index 0521d11..316a620 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -2,11 +2,11 @@ AUTOMAKE_OPTIONS =
BUILT_SOURCES = wconfig.h
-bin_PROGRAMS = wmaker
+bin_PROGRAMS = wmaker.real
EXTRA_DIST =
-wmaker_SOURCES = \
+wmaker_real_SOURCES = \
GNUstep.h \
WindowMaker.h \
actions.c \
@@ -99,7 +99,7 @@ wmaker_SOURCES = \
workspace.c \
workspace.h
-EXTRA_wmaker_SOURCES = osdep_bsd.c osdep_darwin.c osdep_linux.c osdep_stub.c
+EXTRA_wmaker_real_SOURCES = osdep_bsd.c osdep_darwin.c osdep_linux.c osdep_stub.c
AM_CPPFLAGS = $(DFLAGS) -DLOCALEDIR=\"$(NLSDIR)\"
AM_CFLAGS =
@@ -109,7 +109,7 @@ INCLUDES = \
-I$(top_srcdir)/WINGs @HEADER_SEARCH_PATH@
-wmaker_LDADD = \
+wmaker_real_LDADD = \
$(top_builddir)/WINGs/libWINGs.la\
$(top_builddir)/WINGs/libWUtil.la\
$(top_builddir)/wrlib/libwraster.la\
diff --git a/util/Makefile.am b/util/Makefile.am
index 43fd988..a9208c4 100644
--- a/util/Makefile.am
+++ b/util/Makefile.am
@@ -7,9 +7,9 @@ pkgdatadir = $(datadir)/@PACKAGE@
bin_PROGRAMS = wxcopy wxpaste wdwrite wdread getstyle setstyle convertfonts \
seticons geticonset wmsetbg wmagnify wmgenmenu wmmenugen
-bin_SCRIPTS = wmaker.inst wm-oldmenu2new wkdemenu.pl
+bin_SCRIPTS = wmaker.inst wm-oldmenu2new wkdemenu.pl wmaker
-EXTRA_DIST = wmaker.inst.in bughint wm-oldmenu2new directjpeg.c wkdemenu.pl
+EXTRA_DIST = wmaker.inst.in bughint wm-oldmenu2new directjpeg.c wkdemenu.pl wmaker.in
AM_CPPFLAGS = -DLOCALEDIR=\"$(NLSDIR)\"
@@ -71,7 +71,7 @@ wmmenugen_SOURCES = wmmenugen.c wmmenugen.h wmmenugen_misc.c \
wmmenugen_parse_wmconfig.c \
wmmenugen_parse_xdg.c
-CLEANFILES = wmaker.inst
+CLEANFILES = wmaker.inst wmaker
wmaker.inst: $(srcdir)/wmaker.inst.in ./Makefile
-rm -f wmaker.inst
@@ -83,3 +83,13 @@ wmaker.inst: $(srcdir)/wmaker.inst.in ./Makefile
chmod 755 wmaker.inst
+wmaker: $(srcdir)/wmaker.in ./Makefile
+ -rm -f wmaker
+ sed -e "s|#pkgdatadir#|$(pkgdatadir)|" \
+ -e "s|#sysconfdir#|$(sysconfdir)/WindowMaker|" \
+ -e "s|#version#|$(VERSION)|" \
+ -e "s|#bindir#|$(bindir)|" \
+ $(srcdir)/wmaker.in >wmaker
+
+ chmod 755 wmaker
+
diff --git a/util/wmaker.in b/util/wmaker.in
new file mode 100644
index 0000000..f97e4ed
--- /dev/null
+++ b/util/wmaker.in
@@ -0,0 +1,76 @@
+#!/bin/sh
+
+set -e
+
+[ -n "$GNUSTEP_USER_ROOT" ] || export GNUSTEP_USER_ROOT="$HOME/GNUstep"
+gs_base="$GNUSTEP_USER_ROOT"
+gs_defaults="$gs_base/Defaults"
+gs_system_defaults=/etc/GNUstep/Defaults
+wm_base="$gs_base/Library/WindowMaker"
+wm_backgrounds="$wm_base/Backgrounds"
+wm_iconsets="$wm_base/IconSets"
+wm_pixmaps="$wm_base/Pixmaps"
+gs_icons="$gs_base/Library/Icons"
+wm_style="$wm_base/Style"
+wm_styles="$wm_base/Styles"
+wm_themes="$wm_base/Themes"
+WindowMaker=#bindir#/wmaker
+convertfonts=#bindir#/convertfonts
+
+make_dir_if_needed ()
+{
+ if [ ! -d "$1" ] ; then
+ install -m 0755 -d "$1"
+ fi
+}
+
+rename_dir_if_possible ()
+{
+ if [ ! -d "$2" ] ; then
+ if [ -d "$1" ] ; then
+ mv "$1" "$2"
+ fi
+ fi
+}
+
+copy_defaults_if_needed ()
+{
+ file="$gs_defaults/$1"
+ system_file="$gs_system_defaults/$1"
+ if [ ! -f "$file" ] ; then
+ install -m 0644 "$system_file" "$file"
+ fi
+}
+
+make_dir_if_needed "$gs_defaults"
+make_dir_if_needed "$wm_base"
+make_dir_if_needed "$wm_backgrounds"
+make_dir_if_needed "$wm_iconsets"
+make_dir_if_needed "$wm_pixmaps"
+make_dir_if_needed "$gs_icons"
+rename_dir_if_possible "$wm_style" "$wm_styles"
+make_dir_if_needed "$wm_styles"
+make_dir_if_needed "$wm_themes"
+
+copy_defaults_if_needed WindowMaker
+copy_defaults_if_needed WMRootMenu
+copy_defaults_if_needed WMState
+#copy_defaults_if_needed WMWindowAttributes
+
+if [ -x $convertfonts -a ! -e "$wm_base/.fonts_converted" ] ; then
+# --keep-xlfd is used in order to preserve the original information
+ $convertfonts --keep-xlfd "$gs_defaults/WindowMaker"
+ if [ -f "$gs_defaults/WMGLOBAL" ] ; then
+ $convertfonts --keep-xlfd "$gs_defaults/WMGLOBAL"
+ fi
+ find "$wm_styles" -type f -print0 -mindepth 1 -maxdepth 1 |
+ xargs -0 -r -n 1 $convertfonts --keep-xlfd
+ touch "$wm_base/.fonts_converted"
+fi
+
+if [ -n "$1" -a -x "$WindowMaker$1" ] ; then
+ WindowMaker="$WindowMaker$1"
+ shift
+fi
+
+exec "$WindowMaker" "$@"
--
1.7.7.3