summarylogtreecommitdiffstats
path: root/gorsync-git.install
diff options
context:
space:
mode:
Diffstat (limited to 'gorsync-git.install')
-rw-r--r--gorsync-git.install110
1 files changed, 89 insertions, 21 deletions
diff --git a/gorsync-git.install b/gorsync-git.install
index 92a840bd1ae7..00378f5de1bc 100644
--- a/gorsync-git.install
+++ b/gorsync-git.install
@@ -2,13 +2,50 @@ post_install() {
:
#!/usr/bin/env sh
-#if [ -z "$1" ]; then
- export PREFIX=/usr
-#else
+# !!! This script is a part of distribution packaging system !!!
+# !!! Each line of this script was tested and debugged on Linux 32bit, Linux 64bit, FreeBSD !!!
+# !!! Change with great care, do not break it !!!
+
+SCHEMA_FILE="org.d2r2.gorsync.gschema.xml"
+
+get_gsettings_schema_file()
+{
+ local EMBEDDED
+ # ***** !!!!! DO NOT REMOVE THIS COMMENT BLOCK - HEREDOC WILL BE POSTED HERE !!!!! *****
+ # AUTOMATICALLY_REPLACED_WITH_EMBEDDED_XML_FILE_DECLARATION
+ # ***** !!!!! DO NOT REMOVE THIS COMMENT BLOCK - HEREDOC WILL BE POSTED HERE !!!!! *****
+ if [ ${#EMBEDDED} -le 0 ]; then
+ cat "gsettings/${SCHEMA_FILE}"
+ else
+ echo "${EMBEDDED}"
+ fi
+}
+
+
+# if [ -z "$1" ]; then
+ PREFIX=/usr
+ OS_LOWERCASE=$(echo "$OSTYPE" | tr "[:upper:]" "[:lower:]")
+ # FreeBSD
+ if [ "$OS_LOWERCASE" = "freebsd" ]; then
+ PREFIX="${PREFIX}/local"
+ # Linux OS
+ # elif [[ "$OSTYPE" == "linux-gnu" ]]; then
+ # Mac OSX
+ # elif [[ "$OSTYPE" == "darwin"* ]]; then
+ # POSIX compatibility layer and Linux environment emulation for Windows
+ # elif [[ "$OSTYPE" == "cygwin" ]]; then
+ # Lightweight shell and GNU utilities compiled for Windows (part of MinGW)
+ # elif [[ "$OSTYPE" == "msys" ]]; then
+ # Windows
+ # elif [[ "$OSTYPE" == "win32" ]]; then
+ # else
+ # Unknown.
+ fi
+# else
# export PREFIX=$1
-#fi
+# fi
-if [ "$PREFIX" = "/usr" ] && [ "$(id -u)" != "0" ]; then
+if [ "$(id -u)" != "0" ]; then
# Make sure only root can run our script
echo "This script must be run as root" 1>&2
exit 1
@@ -38,34 +75,65 @@ for COMMAND in $COMMANDS; do
i=$(( $i + 1 ))
done
-echo "Installing gsettings schema to prefix ${PREFIX}"
+SCHEMA_PATH=${PREFIX}/share/glib-2.0/schemas
+echo "Installing gsettings schema to ${SCHEMA_PATH}"
# 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/
-
+install -d ${SCHEMA_PATH}
+# install -m 644 gsettings/${SCHEMA_FILE} ${SCHEMA_PATH}/
+echo "$(get_gsettings_schema_file)" > ${SCHEMA_PATH}/${SCHEMA_FILE}
+chmod 0644 ${SCHEMA_PATH}/${SCHEMA_FILE}
+# Redirect output to /dev/null help on some linux distributions (redhat), which produce
+# lot of warnings about "Schema ... are depricated." not related to application.
+glib-compile-schemas ${SCHEMA_PATH}/ 2>/dev/null
}
+
+
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
+# !!! This script is a part of distribution packaging system !!!
+# !!! Each line of this script was tested and debugged on Linux 32bit, Linux 64bit, FreeBSD !!!
+# !!! Change with great care, do not break it !!!
+
+# if [ -z "$1" ]; then
+ PREFIX=/usr
+
+ # FreeBSD
+ if [ $(echo "$OSTYPE" | tr "[:upper:]" "[:lower:]") == "freebsd" ]; then
+ PREFIX="${PREFIX}/local"
+ # Linux OS
+ # elif [[ "$OSTYPE" == "linux-gnu" ]]; then
+ # Mac OSX
+ # elif [[ "$OSTYPE" == "darwin"* ]]; then
+ # POSIX compatibility layer and Linux environment emulation for Windows
+ # elif [[ "$OSTYPE" == "cygwin" ]]; then
+ # Lightweight shell and GNU utilities compiled for Windows (part of MinGW)
+ # elif [[ "$OSTYPE" == "msys" ]]; then
+ # Windows
+ # elif [[ "$OSTYPE" == "win32" ]]; then
+ # else
+ # Unknown.
fi
-#else
+# else
# export PREFIX=$1
-#fi
+# fi
+
+if [ "$(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
-echo "Uninstalling gsettings schema from prefix ${PREFIX}"
+SCHEMA_PATH=${PREFIX}/share/glib-2.0/schemas
+echo "Uninstalling gsettings schema from ${SCHEMA_PATH}"
-rm ${PREFIX}/share/glib-2.0/schemas/org.d2r2.gorsync.gschema.xml
-glib-compile-schemas ${PREFIX}/share/glib-2.0/schemas/
+rm ${SCHEMA_PATH}/org.d2r2.gorsync.gschema.xml
+# Redirect output to /dev/null help on some linux distributions (redhat), which produce
+# lot of warnings about "Schema ... are depricated." not related to application.
+glib-compile-schemas ${SCHEMA_PATH}/ 2>/dev/null
}