kopia lustrzana https://github.com/inkstitch/inkstitch
add deb and rpm building (#1501)
rodzic
5dce5c14e4
commit
5cf0519928
|
@ -19,7 +19,9 @@ jobs:
|
|||
- uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: '16.x'
|
||||
|
||||
- uses: ruby/setup-ruby@v1
|
||||
with:
|
||||
ruby-version: 3.1
|
||||
- uses: actions/cache@v2
|
||||
id: pip-cache
|
||||
with:
|
||||
|
@ -79,6 +81,7 @@ jobs:
|
|||
make dist
|
||||
env:
|
||||
BUILD: linux
|
||||
INKSTITCH_GPG_KEY: ${{ secrets.INKSTITCH_GPG_KEY }}
|
||||
- uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: inkstitch-linux
|
||||
|
@ -236,6 +239,9 @@ jobs:
|
|||
prerelease: "${{env.prerelease}}"
|
||||
title: "${{env.title}}"
|
||||
files: |
|
||||
artifacts/*.zip
|
||||
artifacts/*.exe
|
||||
artifacts/*.pkg
|
||||
artifacts/*.deb
|
||||
artifacts/*.rpm
|
||||
artifacts/*.tar.xz
|
||||
artifacts/*.sh
|
||||
|
|
2
Makefile
2
Makefile
|
@ -49,4 +49,4 @@ version:
|
|||
|
||||
.PHONY: style
|
||||
style:
|
||||
flake8 . --count --max-complexity=10 --max-line-length=150 --statistics --exclude=pyembroidery,__init__.py,electron,build,src
|
||||
flake8 . --count --max-complexity=10 --max-line-length=150 --statistics --exclude=pyembroidery,__init__.py,electron,build,src,dist
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
#!/bin/sh
|
||||
|
||||
inkscape_dir="$(inkscape --system-data-directory)"
|
||||
|
||||
if [ "$?" != 0 ]; then
|
||||
echo "ERROR: Cannot find inkscape system data directory. Is inkscape installed and in root's PATH?"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
rm -f "${inkscape_dir}/extensions/inkstitch"
|
||||
ln -s /opt/inkstitch "${inkscape_dir}/extensions/inkstitch"
|
|
@ -0,0 +1,9 @@
|
|||
#!/bin/sh
|
||||
|
||||
inkscape_dir="$(inkscape --system-data-directory)"
|
||||
|
||||
if [ -n "$inkscape_dir" ]; then
|
||||
if [ -L "${inkscape_dir}/extensions/inkstitch" ]; then
|
||||
rm -f "${inkscape_dir}/extensions/inkstitch"
|
||||
fi
|
||||
fi
|
|
@ -84,7 +84,53 @@ if [ "$BUILD" = "windows" ]; then
|
|||
fi
|
||||
|
||||
if [ "$BUILD" = "linux" ]; then
|
||||
cd dist
|
||||
python -m zipfile -c ../artifacts/inkstitch-${VERSION}-${OS}.zip *;
|
||||
cd ..
|
||||
gem install fpm
|
||||
|
||||
if [[ "$VERSION" =~ ^v[0-9][.0-9]+$ ]]; then
|
||||
VERSION=${VERSION#v}
|
||||
else
|
||||
# dpkg requires versions to start with a number, so we have to add
|
||||
# 0.0.1 for development builds
|
||||
VERSION="0.0.1-${VERSION}"
|
||||
fi
|
||||
|
||||
echo -n "$INKSTITCH_GPG_KEY" | base64 -d | gpg --import
|
||||
cat <<EOF > $HOME/.rpmmacros
|
||||
%_gpg_name EA93BCE2CCD0FB2E77B2CC29E8120E50709E5C44
|
||||
%_signature gpg
|
||||
EOF
|
||||
|
||||
fpm -s dir \
|
||||
-t deb \
|
||||
-n inkstitch \
|
||||
-v "$VERSION" \
|
||||
-d "inkscape >= 1.0.0" \
|
||||
--license "GPL-3.0" \
|
||||
--description "An open-source machine embroidery design platform based on Inkscape" \
|
||||
--url "https://inkstitch.org" \
|
||||
--maintainer "maintainer@inkstitch.org" \
|
||||
--after-install bin/after-install \
|
||||
--before-remove bin/before-remove \
|
||||
--verbose \
|
||||
dist/inkstitch=/opt
|
||||
|
||||
fpm -s dir \
|
||||
-t rpm \
|
||||
-n inkstitch \
|
||||
-v "$VERSION" \
|
||||
-d "inkscape >= 1.0.0" \
|
||||
--license "GPL-3.0" \
|
||||
--description "An open-source machine embroidery design platform based on Inkscape" \
|
||||
--url "https://inkstitch.org" \
|
||||
--maintainer "maintainer@inkstitch.org" \
|
||||
--after-install bin/after-install \
|
||||
--before-remove bin/before-remove \
|
||||
--verbose \
|
||||
dist/inkstitch=/opt
|
||||
|
||||
rpmsign --addsign inkstitch*.rpm
|
||||
mv inkstitch*.deb inkstitch*.rpm artifacts/
|
||||
|
||||
tar -C dist -Jcf artifacts/inkstitch-${VERSION}-${OS}.tar.xz inkstitch
|
||||
cat "$(dirname "$0")/linux-sh-installer" artifacts/inkstitch-${VERSION}-${OS}.tar.xz > artifacts/inkstitch-${VERSION}-${OS}.sh
|
||||
fi
|
||||
|
|
|
@ -0,0 +1,117 @@
|
|||
#!/bin/bash
|
||||
|
||||
# This is a self-extracting archive that installs Ink/Stitch on your Linux
|
||||
# system. This first part is an installer, and after that is a .tar.zx file
|
||||
# containing Ink/Stitch itself.
|
||||
#
|
||||
# To install, simply run this script:
|
||||
#
|
||||
# sh inkstitch-<version>.sh
|
||||
#
|
||||
#
|
||||
# EXPERT STUFF BELOW:
|
||||
#
|
||||
# If you'd rather install it yourself, run this script with --extract to
|
||||
# produce the original inkstitch-<version>.tar.xz file in the current
|
||||
# directory.
|
||||
#
|
||||
# This script will attempt to determine where to install Inkscape user
|
||||
# extensions automatically. If it gets it wrong, you can set one of these
|
||||
# environment variables:
|
||||
#
|
||||
# INKSCAPE_PATH (ex: /usr/bin/inkscape)
|
||||
# The path to the inkscape executable program. This script will ask that program
|
||||
# where to install extensions by passing it the --user-data-directory argument.
|
||||
#
|
||||
# INKSCAPE_EXTENSIONS_PATH (ex: $HOME/.config/inkscape/extensions)
|
||||
# The path to the inkscape extensions directory. Use this to bypass the
|
||||
# --user-data-directory method and specify a directory yourself.
|
||||
|
||||
die() {
|
||||
echo "$*"
|
||||
exit 1
|
||||
}
|
||||
|
||||
extract() {
|
||||
( grep -m1 '^__ARCHIVE__$' > /dev/null; cat ) < "$0"
|
||||
}
|
||||
|
||||
find_inkscape() {
|
||||
# allow expert user override
|
||||
if [ -n "$INKSCAPE_PATH" ]; then
|
||||
echo "$INKSCAPE_PATH"
|
||||
return
|
||||
fi
|
||||
|
||||
inkscape="$(which inkscape)"
|
||||
|
||||
if [ -z "$inkscape" ]; then
|
||||
read -p "Please enter the path to the inkscape program executable (example: /usr/bin/inkscape): " inkscape
|
||||
fi
|
||||
|
||||
if [ ! -x "$inkscape" ]; then
|
||||
die "Inkscape not found or not executable ($inkscape)"
|
||||
fi
|
||||
|
||||
echo "$inkscape"
|
||||
}
|
||||
|
||||
find_extensions_dir() {
|
||||
# allow expert user override
|
||||
if [ -n "$INKSCAPE_EXTENSIONS_PATH" ]; then
|
||||
echo "$INKSCAPE_EXTENSIONS_PATH"
|
||||
return
|
||||
fi
|
||||
|
||||
inkscape="$(find_inkscape)"
|
||||
|
||||
if [ -x "$inkscape" ]; then
|
||||
extensions_dir="$(inkscape --user-data-directory)/extensions"
|
||||
fi
|
||||
|
||||
if [ -z "$extensions_dir" ]; then
|
||||
read -p "Please enter the inkscape user extensions directory (example: $HOME/.config/inkscape/extensions): " extensions_dir
|
||||
fi
|
||||
|
||||
if [ -z "$extensions_dir" ]; then
|
||||
die "Aborting."
|
||||
fi
|
||||
|
||||
mkdir -p "$extensions_dir" || die "unable to create $extensions_dir"
|
||||
|
||||
echo "$extensions_dir"
|
||||
}
|
||||
|
||||
remove_existing() {
|
||||
if [ -e "${1}/inkstitch" ]; then
|
||||
read -p "${1}/inkstitch exists already. It must be removed in order to install $(basename ${0%.sh}). Delete? [y/N] " yesno
|
||||
if [ "$yesno" != "y" -a "$yesno" != "Y" -a "$yesno" != "yes" ]; then
|
||||
die "Aborting."
|
||||
fi
|
||||
|
||||
rm -rf "${1}/inkstitch"
|
||||
fi
|
||||
}
|
||||
|
||||
install_inkstitch() {
|
||||
extensions_dir="$(find_extensions_dir)"
|
||||
echo "Installing Ink/Stitch to ${extensions_dir}/inkstitch"
|
||||
|
||||
remove_existing "$extensions_dir"
|
||||
|
||||
extract | tar -C "$extensions_dir" -Jxf - || die "error while extracting Ink/Stitch"
|
||||
|
||||
echo "Ink/Stitch has been successfully installed. Please restart Inkscape if it is already running."
|
||||
}
|
||||
|
||||
if [ "$1" = "--extract" ]; then
|
||||
dest="${0%.sh}.tar.xz"
|
||||
extract > "$dest"
|
||||
echo "Ink/Stitch extracted to $dest"
|
||||
else
|
||||
install_inkstitch
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
||||
__ARCHIVE__
|
Ładowanie…
Reference in New Issue