Commit edd19fbe authored by Maren Hachmann's avatar Maren Hachmann

Refactoring: Move settings out of the main script file and make this usable on...

Refactoring: Move settings out of the main script file and make this usable on Ubuntu 16.04 with older git. Modify script file so it can be used from a symlink (changes still untested)
parent f89c879f
make_ink_config
......@@ -28,6 +28,10 @@ As of 2018-07-29, this means that you need to execute this installation command
### Step 2: Get the source code:
#### For this script:
Download https://gitlab.com/Moini/make_ink/-/archive/master/make_ink-master.zip and unpack it.
#### For Inkscape:
The script will by default look for the Inkscape source code in your documents directory. To find out where that is type `xdg-user-dir DOCUMENTS`
on the command line. Either in that directory, or in another directory of your choice, clone the git repository for Inkscape:
......@@ -38,11 +42,14 @@ git clone --recurse-submodules https://gitlab.com/inkscape/inkscape.git
(this will create a new directory for your local copy of the Inkscape git repository, which will take very long and require ~2GB of disk space!)
### Step 3: Adapt the script:
### Step 3: Adapt the settings for this script:
In the directory of the make_inkscape.sh script, there is a file called 'make_ink_config_template'. Copy this file to 'make_ink_config'. This is your settings file. If you like, you can adapt the paths used for compilation in that file. The comments explain what they will do.
Default parameters will work okay, too, if you followed the instructions above.
Adapt the parameters of this script (see line 30+, the comments explain what they will do. Default parameters will work okay, too, for almost all values.
The only really important thing is the location of the git clone you made in step 2.). If you did not use your documents directory for it,
then you need to write the correct path at ~ line 41, by replacing the text inside the quotations of "$DOCUMENTS_DIR/inkscape".
The only really important thing is the location of the git clone you made in step 2. If you did not use your documents directory for it,
then you need to write the correct path at ~ line 13, by replacing the text inside the quotations of "$DOCUMENTS_DIR/inkscape".
### Step 4: Run the script:
......@@ -59,7 +66,7 @@ or optionally, run
```
cd /directory/where/script/is_saved
./make_inkscape.sh my_cool_branch_name
./make_inkscape.sh cool_branch_name
```
to install another Inkscape version from another branch, which must be in the common Inkscape git repository.
......@@ -79,7 +86,7 @@ If your desktop environment allows files in your Desktop directory to appear on
but on Xfce, it does) just double-click the file on your desktop to execute. Else navigate to the folder and double-click the file, or
run it via terminal.
You can verify the version in the Help > About submenu.
You can verify the Inkscape version in the Help > About submenu.
And now: have fun playing around with the other versions :) (and please report your findings to the developers).
......
#!/bin/bash
# Default directories (known to work on Ubuntu)
# Desktop folder (if it works, don't change it):
DESKTOP_DIR=$(xdg-user-dir DESKTOP)
# Documents folder (if it works, don't change it):
DOCUMENTS_DIR=$(xdg-user-dir DOCUMENTS)
# Path to git repository. This is the directory with the INSTALL and README
# files for the Inkscape source code and the .git directory in it:
SOURCE_DIR="$DOCUMENTS_DIR/inkscape"
# Directory where the builds shall be installed to (it is suggested to leave this unchanged):
INSTALL_TO="/opt"
# Directory of the script files that you will use to start Inkscape
# (defaults to files being put on your desktop):
STARTER_FILE_PATH="$DESKTOP_DIR"
# Location of the user configuration directories, different from the standard
# one for Inkscape to not mix different versions of preferences.xml file
# and other settings.
# You can leave this as is.
SAVE_PROFILES_TO="$HOME/.config"
# Where to keep the created .deb packages
# Defaults to /home/username/Documents/inkscape_packages
SAVE_DEB_TO="$DOCUMENTS_DIR/inkscape_packages"
#!/bin/bash
# Copyright (c) 2017 Maren Hachmann
#
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
......@@ -22,27 +22,24 @@
# -------------------
# Needed for version numbers and unique directories
DATE=$(date +%Y.%m.%d.%H.%M.%S)
# Default directories (known to work on Ubuntu)
DESKTOP_DIR=$(xdg-user-dir DESKTOP)
DOCUMENTS_DIR=$(xdg-user-dir DOCUMENTS)
MARKER="-->"
# --------------------
# Determine the real location of the script (this is for running via symlink)
SCRIPT_PATH="${BASH_SOURCE[0]}"
while [ -h "$SCRIPT_PATH" ]; do
# resolve $SCRIPT_PATH until the file is no longer a symlink
SCRIPT_DIR="$( cd -P "$( dirname "$SCRIPT_PATH" )" >/dev/null && pwd )"
SCRIPT_PATH="$(readlink "$SCRIPT_PATH")"
# if $SCRIPT_DIR was a relative symlink, we need to resolve it relative to the path where the symlink file was located
[[ $SCRIPT_PATH != /* ]] && SCRIPT_DIR="$SCRIPT_DIR/$SCRIPT_PATH"
done
SCRIPT_DIR="$( cd -P "$( dirname "$SCRIPT_PATH" )" >/dev/null && pwd )"
# ADAPT THIS PART
# (if you have not put the git branch into your user's 'documents' directory)
# ==========================
# git repository, this is the directory with the INSTALL and README files
# for Inkscape and the .git directory in it:
SOURCE_DIR="$DOCUMENTS_DIR/inkscape"
# import settings
source $SCRIPT_DIR/make_ink_config
# Needed for version numbers and unique directories
DATE=$(date +%Y.%m.%d.%H.%M.%S)
# DON'T EDIT THIS PART (but below, there's more):
# ===============================================
MARKER="-->"
# Get into correct directory
cd $SOURCE_DIR
......@@ -59,7 +56,7 @@ elif [ $# -gt 0 ]
BRANCH=$1;
if [ ! "`git branch --list -r origin/${BRANCH} `" ]
then
echo "Sorry, the selected branch $BRANCH doesn't exist in the remote repository. Please select a different branch.";
echo "Sorry, the selected branch $BRANCH doesn't exist in the remote repository. Please select a different branch."
exit 1;
fi
if [ $# -eq 2 ]
......@@ -74,45 +71,31 @@ else
exit 1;
fi
# YOU CAN ADAPT THESE, too:
# =========================
echo "$MARKER Branch $BRANCH selected."
# Directory where the build shall be installed to (it is suggested to leave this unchanged):
INSTALL_DIR="/opt/inkscape_$BRANCH"
# This would be the safer way to do it, only doesn't work on Ubuntu 16.04
# with git 2.7.4...:
# git submodule deinit --all
# Name of the script file that you will use to start this Inkscape version
# (defaults to a file that is put on your desktop):
STARTER_FILE="$DESKTOP_DIR/Ink_$BRANCH"
# yeah...this is what git suggests to get rid of the submodule:
rm -r -f share/extensions
# Location of the user configuration, different from the standard one for Inkscape
# to not mix different versions of preferences.xml file. You can leave this as is.
PROFILE_DIR="$HOME/.config/inkscape_$BRANCH"
# Where to keep the created .deb package
# Defaults to /home/username/Documents/inkscape_packages/<compilation date>
SAVE_DEB_TO="$DOCUMENTS_DIR/inkscape_packages/$BRANCH_$DATE"
# To trigger a build, even if there were no changes,
# just delete the 'build' folder in the SOURCE_DIR.
# =========================
# END OF SETTINGS SECTION
echo "$MARKER Branch $BRANCH selected.";
git submodule deinit --all;
git clean -d -f;
# cleanup, so there won't be anything to commit, causing git to refuse switching branches
git checkout -- .
git clean -d -f
# get into correct branch
git checkout $BRANCH;
# check if there are new commits
REVISION_OLD=$(git log -1 --format="%h");
git pull;
git submodule update --init --recursive;
REVISION_OLD=$(git log -1 --format="%h")
git pull
git submodule update --init --recursive
REVISION=$(git log -1 --format="%h")
$INSTALL_DIR=$INSTALL_TO/inkscape_$BRANCH
if [ ! -f "$INSTALL_DIR/bin/inkscape" ] || [ ! -f "$SOURCE_DIR/build/bin/inkscape" ] || [ ! "$REVISION" == "$REVISION_OLD" ]; then
echo "$MARKER Update in progress..."
else
......@@ -139,22 +122,26 @@ make -j3
echo "Inkscape Development version as of $DATE, revision $REVISION" > description-pak
# Create directory where to save the package
mkdir -p $SAVE_DEB_TO
PACKAGE_DIR=$SAVE_DEBS_TO/$BRANCH_$DATE
mkdir -p $PACKAGE_DIR
# Build the .deb package
echo "$MARKER Building Debian package..."
checkinstall -y -D --fstrans=yes --install=no --pkgname inkscape-$BRANCH --pkgversion $DATE$REVISION --nodoc --maintainer "$USER" --arch amd64 --pakdir $SAVE_DEB_TO --pkgsource "$REMOTE" --exclude="$SOURCE_DIR/.git"
checkinstall -y -D --fstrans=yes --install=no --pkgname inkscape-$BRANCH --pkgversion $DATE$REVISION --nodoc --maintainer "$USER" --arch amd64 --pakdir $PACKAGE_DIR --pkgsource "$REMOTE" --exclude="$SOURCE_DIR/.git"
# Create user configuration directory, if doesn't exist
PROFILE_DIR=$SAVE_PROFILES_TO/inkscape_$BRANCH
mkdir -p $PROFILE_DIR
# Install new package
echo "$MARKER Installing new version..."
notify-send 'Build Completed!' 'Please enter your password to install.' --icon=dialog-information
sudo dpkg -i $SAVE_DEB_TO/inkscape-*.deb
sudo dpkg -i $PACKAGE_DIR/inkscape-*.deb
INK_PROG="$INSTALL_DIR/bin/inkscape"
INK_DIR="$INSTALL_DIR/bin"
STARTER_FILE=$STARTER_FILE_PATH/Run_Ink_$BRANCH
# Create start script
echo "#!/bin/bash
......@@ -170,6 +157,6 @@ $STARTER_FILE
The .deb package that has been built is available in
$SAVE_DEB_TO"
$SAVE_DEBS_TO"
notify-send 'Package installed!' 'Enjoy running your new Inkscape build!' --icon=dialog-information
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment