@@ -4,21 +4,16 @@ die () {
4
4
exit 1
5
5
}
6
6
7
- make_absolute () {
8
- case " $1 " in
9
- /* )
10
- echo " $1 "
11
- ;;
12
- * )
13
- echo " $PWD /$1 "
14
- ;;
15
- esac
16
- }
17
-
18
- # ####################################################################
19
- # Building
20
- # ####################################################################
21
7
echo " Building Packaging.Linux..."
8
+
9
+ # Directories
10
+ THISDIR=" $( cd " $( dirname " $0 " ) " ; pwd -P ) "
11
+ ROOT=" $( cd " $THISDIR " /../../.. ; pwd -P ) "
12
+ SRC=" $ROOT /src"
13
+ OUT=" $ROOT /out"
14
+ INSTALLER_SRC=" $SRC /linux/Packaging.Linux"
15
+ INSTALLER_OUT=" $OUT /linux/Packaging.Linux"
16
+
22
17
# Parse script arguments
23
18
for i in " $@ "
24
19
do
@@ -32,7 +27,7 @@ case "$i" in
32
27
shift # past argument=value
33
28
;;
34
29
--install-from-source=* )
35
- INSTALL_FROM_SOURCE=${i#* =}
30
+ INSTALL_FROM_SOURCE=" ${i#* =} "
36
31
shift # past argument=value
37
32
;;
38
33
* )
@@ -41,208 +36,47 @@ case "$i" in
41
36
esac
42
37
done
43
38
44
- # Directories
45
- THISDIR=" $( cd " $( dirname " $0 " ) " ; pwd -P ) "
46
- ROOT=" $( cd " $THISDIR " /../../.. ; pwd -P ) "
47
- SRC=" $ROOT /src"
48
- OUT=" $ROOT /out"
49
- GCM_SRC=" $SRC /shared/Git-Credential-Manager"
50
- GCM_UI_SRC=" $SRC /shared/Git-Credential-Manager.UI.Avalonia"
51
- BITBUCKET_UI_SRC=" $SRC /shared/Atlassian.Bitbucket.UI.Avalonia"
52
- GITHUB_UI_SRC=" $SRC /shared/GitHub.UI.Avalonia"
53
- GITLAB_UI_SRC=" $SRC /shared/GitLab.UI.Avalonia"
54
- PROJ_OUT=" $OUT /linux/Packaging.Linux"
55
-
56
- # Build parameters
57
- FRAMEWORK=net6.0
58
- RUNTIME=linux-x64
59
-
60
39
# Perform pre-execution checks
61
40
CONFIGURATION=" ${CONFIGURATION:= Debug} "
62
41
if [ -z " $VERSION " ]; then
63
42
die " --version was not set"
64
43
fi
65
44
66
- if [ $INSTALL_FROM_SOURCE = false ]; then
67
- ARCH=" ` dpkg-architecture -q DEB_HOST_ARCH` "
68
- if test -z " $ARCH " ; then
69
- die " Could not determine host architecture!"
70
- fi
71
- fi
72
-
73
- # Outputs
74
- PAYLOAD=" $PROJ_OUT /payload/$CONFIGURATION "
75
- SYMBOLOUT=" $PROJ_OUT /payload.sym/$CONFIGURATION "
76
-
77
- if [ $INSTALL_FROM_SOURCE = false ]; then
78
- TAROUT=" $PROJ_OUT /tar/$CONFIGURATION "
79
- TARBALL=" $TAROUT /gcm-linux_$ARCH .$VERSION .tar.gz"
80
- SYMTARBALL=" $TAROUT /gcm-linux_$ARCH .$VERSION -symbols.tar.gz"
45
+ OUTDIR=" $INSTALLER_OUT /$CONFIGURATION "
46
+ PAYLOAD=" $OUTDIR /payload"
81
47
82
- DEBOUT=" $PROJ_OUT /deb/$CONFIGURATION "
83
- DEBROOT=" $DEBOUT /root"
84
- DEBPKG=" $DEBOUT /gcm-linux_$ARCH .$VERSION .deb"
85
- else
48
+ if [ $INSTALL_FROM_SOURCE = true ]; then
86
49
INSTALL_LOCATION=" /usr/local"
87
- fi
88
-
89
- # Cleanup payload directory
90
- if [ -d " $PAYLOAD " ]; then
91
- echo " Cleaning existing payload directory '$PAYLOAD '..."
92
- rm -rf " $PAYLOAD "
93
- fi
94
-
95
- # Cleanup symbol directory
96
- if [ -d " $SYMBOLOUT " ]; then
97
- echo " Cleaning existing symbols directory '$SYMBOLOUT '..."
98
- rm -rf " $SYMBOLOUT "
99
- fi
100
-
101
- # Ensure directories exists
102
- mkdir -p " $PAYLOAD " " $SYMBOLOUT "
103
-
104
- if [ $INSTALL_FROM_SOURCE = false ]; then
105
- mkdir -p " $DEBROOT "
106
- else
107
50
mkdir -p " $INSTALL_LOCATION "
108
- fi
109
-
110
- if [ -z " $DOTNET_ROOT " ]; then
111
- DOTNET_ROOT=" $( dirname $( which dotnet) ) "
112
- fi
113
-
114
- # Publish core application executables
115
- echo " Publishing core application..."
116
- $DOTNET_ROOT /dotnet publish " $GCM_SRC " \
117
- --configuration=" $CONFIGURATION " \
118
- --framework=" $FRAMEWORK " \
119
- --runtime=" $RUNTIME " \
120
- --self-contained=true \
121
- -p:PublishSingleFile=true \
122
- --output=" $( make_absolute " $PAYLOAD " ) " || exit 1
123
-
124
- echo " Publishing core UI helper..."
125
- $DOTNET_ROOT /dotnet publish " $GCM_UI_SRC " \
126
- --configuration=" $CONFIGURATION " \
127
- --framework=" $FRAMEWORK " \
128
- --runtime=" $RUNTIME " \
129
- --self-contained=true \
130
- -p:PublishSingleFile=true \
131
- --output=" $( make_absolute " $PAYLOAD " ) " || exit 1
132
-
133
- echo " Publishing Bitbucket UI helper..."
134
- $DOTNET_ROOT /dotnet publish " $BITBUCKET_UI_SRC " \
135
- --configuration=" $CONFIGURATION " \
136
- --framework=" $FRAMEWORK " \
137
- --runtime=" $RUNTIME " \
138
- --self-contained=true \
139
- -p:PublishSingleFile=true \
140
- --output=" $( make_absolute " $PAYLOAD " ) " || exit 1
141
-
142
- echo " Publishing GitHub UI helper..."
143
- $DOTNET_ROOT /dotnet publish " $GITHUB_UI_SRC " \
144
- --configuration=" $CONFIGURATION " \
145
- --framework=" $FRAMEWORK " \
146
- --runtime=" $RUNTIME " \
147
- --self-contained=true \
148
- -p:PublishSingleFile=true \
149
- --output=" $( make_absolute " $PAYLOAD " ) " || exit 1
150
-
151
- echo " Publishing GitLab UI helper..."
152
- $DOTNET_ROOT /dotnet publish " $GITLAB_UI_SRC " \
153
- --configuration=" $CONFIGURATION " \
154
- --framework=" $FRAMEWORK " \
155
- --runtime=" $RUNTIME " \
156
- --self-contained=true \
157
- -p:PublishSingleFile=true \
158
- --output=" $( make_absolute " $PAYLOAD " ) " || exit 1
159
-
160
- # Collect symbols
161
- echo " Collecting managed symbols..."
162
- mv " $PAYLOAD " /* .pdb " $SYMBOLOUT " || exit 1
163
-
164
- echo " Build complete."
165
-
166
- # ####################################################################
167
- # PACKING AND INSTALLING
168
- # ####################################################################
169
- # Set full read, write, execute permissions for owner and just read and execute permissions for group and other
170
- echo " Setting file permissions..."
171
- /bin/chmod -R 755 " $PAYLOAD " || exit 1
172
51
173
- if [ $INSTALL_FROM_SOURCE = false ]; then
174
- echo " Packing Packaging.Linux..."
175
- # Cleanup any old archive files
176
- if [ -e " $TAROUT " ]; then
177
- echo " Deleteing old archive '$TAROUT '..."
178
- rm " $TAROUT "
179
- fi
180
-
181
- # Ensure the parent directory for the archive exists
182
- mkdir -p " $TAROUT " || exit 1
183
-
184
- # Build binaries tarball
185
- echo " Building binaries tarball..."
186
- pushd " $PAYLOAD "
187
- tar -czvf " $TARBALL " * || exit 1
188
- popd
189
-
190
- # Build symbols tarball
191
- echo " Building symbols tarball..."
192
- pushd " $SYMBOLOUT "
193
- tar -czvf " $SYMTARBALL " * || exit 1
194
- popd
195
-
196
- # Build .deb
197
- INSTALL_TO=" $DEBROOT /usr/local/share/gcm-core/"
198
- LINK_TO=" $DEBROOT /usr/local/bin/"
199
- mkdir -p " $DEBROOT /DEBIAN" " $INSTALL_TO " " $LINK_TO " || exit 1
200
-
201
- # make the debian control file
202
- # this is purposefully not indented, see
203
- # https://stackoverflow.com/questions/9349616/bash-eof-in-if-statement
204
- # for details
205
- cat > " $DEBROOT /DEBIAN/control" << EOF
206
- Package: gcm
207
- Version: $VERSION
208
- Section: vcs
209
- Priority: optional
210
- Architecture: $ARCH
211
- Depends:
212
- Maintainer: GCM <[email protected] >
213
- Description: Cross Platform Git Credential Manager command line utility.
214
- GCM supports authentication with a number of Git hosting providers
215
- including GitHub, BitBucket, and Azure DevOps.
216
- For more information see https://aka.ms/gcm
217
- EOF
218
- else
219
52
echo " Installing..."
220
53
221
54
# Install directories
222
55
INSTALL_TO=" $INSTALL_LOCATION /share/gcm-core/"
223
56
LINK_TO=" $INSTALL_LOCATION /bin/"
224
- MESSAGE=" Install complete."
225
- fi
226
57
227
- mkdir -p " $INSTALL_TO " " $LINK_TO "
58
+ mkdir -p " $INSTALL_TO " " $LINK_TO "
228
59
229
- # Copy all binaries and shared libraries to target installation location
230
- cp -R " $PAYLOAD " /* " $INSTALL_TO " || exit 1
60
+ # Copy all binaries and shared libraries to target installation location
61
+ cp -R " $PAYLOAD " /* " $INSTALL_TO " || exit 1
231
62
232
- # Create symlink
233
- if [ ! -f " $LINK_TO /git-credential-manager" ]; then
234
- ln -s -r " $INSTALL_TO /git-credential-manager" \
235
- " $LINK_TO /git-credential-manager" || exit 1
236
- fi
63
+ # Create symlink
64
+ if [ ! -f " $LINK_TO /git-credential-manager" ]; then
65
+ ln -s -r " $INSTALL_TO /git-credential-manager" \
66
+ " $LINK_TO /git-credential-manager" || exit 1
67
+ fi
237
68
238
- # Create legacy symlink with older name
239
- if [ ! -f " $LINK_TO /git-credential-manager-core" ]; then
240
- ln -s -r " $INSTALL_TO /git-credential-manager" \
241
- " $LINK_TO /git-credential-manager-core" || exit 1
242
- fi
69
+ # Create legacy symlink with older name
70
+ if [ ! -f " $LINK_TO /git-credential-manager-core" ]; then
71
+ ln -s -r " $INSTALL_TO /git-credential-manager" \
72
+ " $LINK_TO /git-credential-manager-core" || exit 1
73
+ fi
243
74
244
- if [ $INSTALL_FROM_SOURCE = false ]; then
245
- dpkg-deb --build " $DEBROOT " " $DEBPKG " || exit 1
75
+ echo " Install complete."
76
+ else
77
+ # Layout and pack
78
+ " $INSTALLER_SRC /layout.sh" --configuration=" $CONFIGURATION " --output=" $PAYLOAD " --symbol-output=" $" || exit 1
79
+ " $INSTALLER_SRC /pack.sh" --configuration=" $CONFIGURATION " --payload=" $PAYLOAD " --version=" $VERSION " || exit 1
246
80
fi
247
81
248
- echo $MESSAGE
82
+ echo " Build of Packaging.Linux complete. "
0 commit comments