Skip to content

Commit

Permalink
installation: fix installation on Windows (lindell#307)
Browse files Browse the repository at this point in the history
  • Loading branch information
fabasoad authored Nov 17, 2022
1 parent e387429 commit b62a2df
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 17 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/test-install.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
name: Test install.sh

on:
pull_request:
paths:
- .github/workflows/test-install.yaml
- install.sh

jobs:
test-install-sh:
name: Test install.sh
strategy:
fail-fast: false
matrix:
os: ['ubuntu-latest', 'macos-latest', 'windows-latest']
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Install multi-gitter
env:
BINDIR: ${{ github.workspace }}/bin
run: |
curl -s https://raw.githubusercontent.com/${{ github.event.pull_request.head.repo.full_name }}/${{ github.head_ref }}/install.sh | sh -s -- -d
echo "${{ github.workspace }}/bin" >> $GITHUB_PATH
shell: sh
- name: Print version
run: multi-gitter version
shell: sh
26 changes: 9 additions & 17 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ usage() {
$this: download go binaries for lindell/multi-gitter
Usage: $this [-b] bindir [-d] [tag]
-b sets bindir or installation directory, Defaults to ./bin
-b sets bindir or installation directory, Defaults to /usr/local/bin
-d turns on debug logging
[tag] is a tag from
https://github.com/lindell/multi-gitter/releases
Expand Down Expand Up @@ -51,14 +51,15 @@ execute() {
(cd "${tmpdir}" && untar "${TARBALL}")
test ! -d "${BINDIR}" && install -d "${BINDIR}"
for binexe in $BINARIES; do
if [ "$OS" = "windows" ]; then
binexe="${binexe}.exe"
fi
if test -w "${BINDIR}/${binexe}"; then
install "${srcdir}/${binexe}" "${BINDIR}/${binexe}"
if [ "$OS" = "Windows" ]; then
install "${srcdir}/${binexe}.exe" "${BINDIR}/${binexe}.exe"
else
log_info "not allowed to install binary without higher privilege"
sudo install "${srcdir}/${binexe}" "${BINDIR}/${binexe}"
if test -w "${BINDIR}/${binexe}"; then
install "${srcdir}/${binexe}" "${BINDIR}/${binexe}"
else
log_info "not allowed to install binary without higher privilege"
sudo install "${srcdir}/${binexe}" "${BINDIR}/${binexe}"
fi
fi
log_info "installed ${BINDIR}/${binexe}"
done
Expand Down Expand Up @@ -99,13 +100,6 @@ tag_to_version() {
TAG="$REALTAG"
VERSION=${TAG#v}
}
adjust_format() {
# change format based on OS
case ${OS} in
windows) FORMAT=.exe ;;
esac
true
}
adjust_os() {
# adjust archive name based on OS
case ${OS} in
Expand Down Expand Up @@ -388,8 +382,6 @@ get_binaries

tag_to_version

adjust_format

adjust_os

adjust_arch
Expand Down

0 comments on commit b62a2df

Please sign in to comment.