summaryrefslogtreecommitdiff
path: root/engines/balou/scripts/balou-export-theme
blob: b682067bc5b0a876accabe18a3fb2f3f04ded21b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/sh
#
# $Id$
#
# Copyright (c) 2004 Benedikt Meurer <benny@xfce.org>
# All rights reserved.
#
# 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, 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., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
#

if test $# -ne 2; then
  echo "Usage: balou-export-theme <themerc> <targetfile>" >&2
  exit 1
fi

themerc="${1}"
targetfile="${2}"

# check theme
baloudir=`dirname "${themerc}"`
basedir=`dirname "${baloudir}"`
themesdir=`dirname "${basedir}"`
themename=`basename "${basedir}"`
if test ! -d "${baloudir}" -o ! -d "${basedir}" -o ! -d "${themesdir}"; then
  echo "Broken theme detected." >&2
  exit 1
fi

# tarup theme
(cd "${themesdir}" \
  && (tar cf - "${themename}/balou" \
      | gzip --best > "${targetfile}")) > /dev/null 2>&1
if test $? -ne 0; then
  echo "Unable to export theme ${themename} to file ${targetfile}" >&2
  exit 1
fi

exit 0