Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow setting an install prefix #63

Merged
merged 1 commit into from
Jan 26, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 18 additions & 6 deletions install.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
if [ -z "$1" ]; then
export PREFIX=/usr
else
export PREFIX=$1
fi

echo "Installing to prefix ${PREFIX}"

# Make sure only root can run our script
if [ "$(id -u)" != "0" ]; then
echo "This script must be run as root" 1>&2
Expand All @@ -7,15 +15,17 @@ fi
function processPOFile {
echo "Processing ${1}"
LOCALE=$(basename "$1" .po)
msgfmt $1 -o /usr/share/locale/${LOCALE}/LC_MESSAGES/terminix.mo
mkdir -p ${PREFIX}/share/locale/${LOCALE}/LC_MESSAGES
msgfmt $1 -o ${PREFIX}/share/locale/${LOCALE}/LC_MESSAGES/terminix.mo
}

# Copy and compile schema
echo "Copying and compiling schema..."
cp data/gsettings/com.gexperts.Terminix.gschema.xml /usr/share/glib-2.0/schemas/
glib-compile-schemas /usr/share/glib-2.0/schemas/
mkdir -p ${PREFIX}/share/glib-2.0/schemas
cp data/gsettings/com.gexperts.Terminix.gschema.xml ${PREFIX}/share/glib-2.0/schemas/
glib-compile-schemas ${PREFIX}/share/glib-2.0/schemas/

export TERMINIX_SHARE=/usr/share/terminix
export TERMINIX_SHARE=${PREFIX}/share/terminix

mkdir -p ${TERMINIX_SHARE}/resources
mkdir -p ${TERMINIX_SHARE}/schemes
Expand All @@ -37,5 +47,7 @@ export -f processPOFile
ls po/*.po | xargs -n 1 -P 10 -I {} bash -c 'processPOFile "$@"' _ {}

# Copy executable and desktop file
cp terminix /usr/bin/terminix
cp data/pkg/desktop/com.gexperts.Terminix.desktop /usr/share/applications
mkdir -p ${PREFIX}/bin
cp terminix ${PREFIX}/bin/terminix
mkdir -p ${PREFIX}/share/applications
cp data/pkg/desktop/com.gexperts.Terminix.desktop ${PREFIX}/share/applications