forked from openstenoproject/plover
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpackpack.sh
executable file
·100 lines (89 loc) · 1.51 KB
/
packpack.sh
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#!/bin/bash
set -e
. ./utils/functions.sh
BUILD_DIR="build/packpack"
DIST_DIR="dist"
opt_no_pull=0
parse_opts args "$@"
set -- "${args[@]}"
while [ $# -ne 0 ]
do
case "$1" in
--no-pull)
opt_no_pull=1
;;
-*)
err "invalid option: $1"
exit 1
;;
*)
break
;;
esac
shift
done
[ $# -eq 1 ]
REPO='plover/packpack'
case "$1" in
appimage)
OS='appimage'
DIST='2'
EXT='AppImage'
TARGET="appimage"
;;
archlinux)
OS='archlinux'
DIST='1'
EXT='pkg.tar.xz'
TARGET='makepkg'
;;
rawhide)
OS='fedora'
DIST='rawhide'
EXT='noarch.rpm'
TARGET="package"
;;
trusty)
OS='ubuntu'
DIST='trusty'
EXT='deb'
TARGET="package"
;;
xenial)
OS='ubuntu'
DIST='xenial'
EXT='deb'
TARGET="package"
;;
*)
err "unsupported target: $1"
exit 1
;;
esac
shift
NAME='plover'
VERSION="$(./setup.py --version)"
SDIST="$DIST_DIR/$NAME-$VERSION.tar.xz"
run rm -rf "$BUILD_DIR"
run mkdir -p "$BUILD_DIR" "$DIST_DIR" .cache
setup_cmd=(./setup.py -q sdist --format=xztar)
if [ "$TARGET" = 'appimage' ]
then
setup_cmd+=(bdist_wheel)
fi
run "${setup_cmd[@]}"
run cp "$SDIST" "$BUILD_DIR/"
cmd=(env)
if [ $opt_no_pull -ne 0 ]
then
cmd+=(NO_PULL=1)
fi
cmd+=(
BUILDDIR="$PWD/$BUILD_DIR" CACHE_DIR="$PWD/.cache"
DOCKER_REPO="$REPO"
OS="$OS" DIST="$DIST"
PRODUCT="$NAME" VERSION="$VERSION"
packpack -f /source/linux/packpack.mk "$TARGET"
)
run "${cmd[@]}"
run_eval "mv '$BUILD_DIR/'*.$EXT '$DIST_DIR/'"