source: branches/items/SH/arb_help_useredit.sh

Last change on this file was 11525, checked in by westram, 11 years ago
  • hack to allow users to edit arb helpfiles and easily send them to us
  • Property svn:executable set to *
File size: 1.6 KB
Line 
1#!/bin/bash
2#
3# helper script to pack helpfiles edited in userland into a tarball
4# in order to send them back to ARB developers
5
6TARBALL=~/arb_edited_helpfiles.tgz
7HELPFILE=${1:-}
8MODE=${2:-}
9
10pack() {
11    local WORKDIR=~/.arb_tmp/help.$$
12    mkdir -p $WORKDIR
13    local PREVDIR=`pwd`
14    cd $WORKDIR
15
16    local SUFFIX=ORG
17    if [ "$MODE" = "end" ]; then
18        SUFFIX=USEREDIT
19    fi
20
21    local PACKED_FILE=$WORKDIR/${HELPFILE%.hlp}_${SUFFIX}.hlp
22    local FULLHELP=${ARBHOME}/lib/help/${HELPFILE}
23
24    if [ -f $TARBALL ]; then
25        tar -zxf $TARBALL
26    fi
27
28    if [ -f $PACKED_FILE ]; then
29        if [ "$MODE" = "end" ]; then
30            cp -p $FULLHELP $PACKED_FILE
31        fi
32    else
33        cp -p $FULLHELP $PACKED_FILE
34    fi
35
36    tar -zcf $TARBALL .
37
38    cd $PREVDIR
39    rm -rf $WORKDIR
40}
41
42show() {
43    if [ -f $TARBALL ]; then
44        echo "------------------------------------------------------------"
45        echo "Your helpfile modifications were stored in archive"
46        echo "    $TARBALL"
47        echo "Contents are:"
48        echo ""
49        tar -ztvf $TARBALL
50        echo ""
51        echo "Please send that file to devel@arb-home.de if you think"
52        echo "your modifications should be available to the public."
53        echo "(Remove the archive file afterwards)"
54        echo "------------------------------------------------------------"
55    fi
56}
57
58case "$MODE" in
59    start|end)
60    pack $HELPFILE $MODE
61    if [ "$MODE" = "end" ]; then show; fi
62    ;;
63
64    *)
65    echo "Usage: arb_help_useredit.sh helpfile start|end"
66    echo "Packs current state of 'helpfile' into $TARBALL"
67    echo "Script is called by ARB whenever you edit a helpfile"
68    ;;
69esac
70
Note: See TracBrowser for help on using the repository browser.