summarylogtreecommitdiffstats
path: root/gorsync-git.install
blob: 92a840bd1ae730a5104b55b50792a1959415a045 (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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
post_install() {
    :
#!/usr/bin/env sh

#if [ -z  "$1" ]; then
    export PREFIX=/usr
#else
#    export PREFIX=$1
#fi

if [ "$PREFIX" = "/usr" ] && [ "$(id -u)" != "0" ]; then
    # Make sure only root can run our script
    echo "This script must be run as root" 1>&2
    exit 1
fi

# Check availability of required commands
# COMMANDS="install glib-compile-schemas glib-compile-resources msgfmt desktop-file-validate gtk-update-icon-cache"
COMMANDS="install glib-compile-schemas glib-compile-resources msgfmt desktop-file-validate gtk-update-icon-cache"
# if [ "$PREFIX" = '/usr' ] || [ "$PREFIX" = "/usr/local" ]; then
#     COMMANDS="$COMMANDS xdg-desktop-menu"
# fi
# PACKAGES="coreutils glib2 glib2 gettext desktop-file-utils gtk-update-icon-cache xdg-utils"
PACKAGES="coreutils glib2 glib2 gettext desktop-file-utils gtk-update-icon-cache xdg-utils"
i=0
for COMMAND in $COMMANDS; do
    type $COMMAND >/dev/null 2>&1 || {
        j=0
        for PACKAGE in $PACKAGES; do
            if [ $i = $j ]; then
                break
            fi
            j=$(( $j + 1 ))
        done
        echo "Your system is missing command $COMMAND, please install $PACKAGE"
        exit 1
    }
    i=$(( $i + 1 ))
done

echo "Installing gsettings schema to prefix ${PREFIX}"

# Copy and compile schema
echo "Copying and compiling schema..."
install -d ${PREFIX}/share/glib-2.0/schemas
install -m 644 gsettings/org.d2r2.gorsync.gschema.xml ${PREFIX}/share/glib-2.0/schemas/
glib-compile-schemas ${PREFIX}/share/glib-2.0/schemas/


}
pre_remove() {
    :
#!/usr/bin/env sh

#if [ -z  "$1" ]; then
    export PREFIX=/usr
    # Make sure only root can run our script
    if [ "$(id -u)" != "0" ]; then
        echo "This script must be run as root" 1>&2
        exit 1
    fi
#else
#    export PREFIX=$1
#fi

echo "Uninstalling gsettings schema from prefix ${PREFIX}"

rm ${PREFIX}/share/glib-2.0/schemas/org.d2r2.gorsync.gschema.xml
glib-compile-schemas ${PREFIX}/share/glib-2.0/schemas/

}