forked from 0install/0install
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh.src
107 lines (93 loc) · 3.86 KB
/
install.sh.src
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
101
102
103
104
105
106
107
#!/bin/sh
set -eu
cd `dirname $0`/files
echo Testing binary...
./0install --version | head -1
echo OK
echo
# This file gets copied into the build/static_dist directory as "install.sh". It can be run
# from there to install everything.
if [ $# != 1 ]; then
echo "To install to /usr/local:"
echo "./install.sh local"
echo
echo "To install to your home directory:"
echo "./install.sh home"
echo
echo "You can also just run \"./files/0install\" directly, but"
echo "some features won't work unless \"0install\" is in \$PATH."
exit 1
fi
DOCS="../README.md ../COPYING"
MANPAGES="0launch.1 0store-secure-add.1 0store.1 0desktop.1 0install.1"
PLUGINS=`find . -name 'gui_gtk.c*[sa]' -print`
# Use "share/zsh/vendor-completions" on Debian
ZSHFUNCTIONS="share/zsh/site-functions"
case "$1" in
home)
# Note sure about PREFIX_MAN, but this is what the old Python version did
PREFIX="${HOME}"
ZSHFUNCTIONS=".zsh"
PREFIX_SHARE="${HOME}/.local/share"
PREFIX_MAN="${HOME}/.local/man"
;;
system)
PREFIX="/usr"
PREFIX_SHARE="${PREFIX}/share"
PREFIX_MAN="${PREFIX_SHARE}/man"
;;
local)
PREFIX="/usr/local"
PREFIX_SHARE="${PREFIX}/share"
PREFIX_MAN="${PREFIX}/man"
;;
/*)
PREFIX="$1"
PREFIX_SHARE="${PREFIX}/share"
PREFIX_MAN="${PREFIX_SHARE}/man"
;;
*)
echo "Use: \"./install.sh local\" to install"
exit 1
;;
esac
echo "Installing to ${DESTDIR:=""}$PREFIX/..."
install -d "$DESTDIR${PREFIX}/bin"
install 0install "$DESTDIR${PREFIX}/bin/0install"
ln -f "$DESTDIR${PREFIX}/bin/0install" "$DESTDIR${PREFIX}/bin/0launch"
ln -f "$DESTDIR${PREFIX}/bin/0install" "$DESTDIR${PREFIX}/bin/0store"
ln -f "$DESTDIR${PREFIX}/bin/0install" "$DESTDIR${PREFIX}/bin/0store-secure-add"
ln -f "$DESTDIR${PREFIX}/bin/0install" "$DESTDIR${PREFIX}/bin/0desktop"
ln -f "$DESTDIR${PREFIX}/bin/0install" "$DESTDIR${PREFIX}/bin/0alias"
install -d "$DESTDIR${PREFIX_MAN}/man1/"
install -d "$DESTDIR${PREFIX_SHARE}/0install.net/"
install -d "$DESTDIR${PREFIX_SHARE}/applications/"
install -d "$DESTDIR${PREFIX_SHARE}/appdata/"
install -d "$DESTDIR${PREFIX_SHARE}/bash-completion/completions/"
install -d "$DESTDIR${PREFIX_SHARE}/fish/completions"
install -d "$DESTDIR${PREFIX_SHARE}/doc/0install"
install -d "$DESTDIR${PREFIX}/${ZSHFUNCTIONS}"
install -d "$DESTDIR${PREFIX}/lib/0install.net"
install -m 0644 ${DOCS} "$DESTDIR${PREFIX_SHARE}/doc/0install/"
install -m 0644 ${MANPAGES} "$DESTDIR${PREFIX_MAN}/man1/"
install -m 0644 share/applications/0install.desktop "$DESTDIR${PREFIX_SHARE}/applications/"
install -m 0644 share/appdata/0install.appdata.xml "$DESTDIR${PREFIX_SHARE}/appdata/"
install -m 0644 share/bash-completion/completions/0install "$DESTDIR${PREFIX_SHARE}/bash-completion/completions/"
install -m 0644 share/bash-completion/completions/0launch "$DESTDIR${PREFIX_SHARE}/bash-completion/completions/"
install -m 0644 share/fish/completions/0install.fish "$DESTDIR${PREFIX_SHARE}/fish/completions/"
install -m 0644 share/fish/completions/0launch.fish "$DESTDIR${PREFIX_SHARE}/fish/completions/"
install -m 0644 share/zsh/site-functions/_0install "$DESTDIR${PREFIX}/${ZSHFUNCTIONS}/"
install -m 0644 share/zsh/site-functions/_0launch "$DESTDIR${PREFIX}/${ZSHFUNCTIONS}/"
install -m 0755 share/0install.net/unlzma "$DESTDIR${PREFIX_SHARE}/0install.net/"
install -m 0755 share/0install.net/unxz "$DESTDIR${PREFIX_SHARE}/0install.net/"
if [ -n "$PLUGINS" ]; then
install -m 0644 $PLUGINS "$DESTDIR${PREFIX}/lib/0install.net/"
fi
for size in 24x24 48x48 128x128 scalable; do \
install -d "$DESTDIR${PREFIX_SHARE}/icons/hicolor/${size}/apps/" && \
install -m 0644 share/icons/${size}/* "$DESTDIR${PREFIX_SHARE}/icons/hicolor/${size}/apps/"; done
(cd share && for locale in locale/*; do \
install -d "$DESTDIR${PREFIX_SHARE}/${locale}/LC_MESSAGES/" && \
install -m 0644 "${locale}/LC_MESSAGES/zero-install.mo" "$DESTDIR${PREFIX_SHARE}/${locale}/LC_MESSAGES/"; \
done)
echo "OK. Now run \"$DESTDIR${PREFIX}/bin/0install --help\" for help."