Skip to content

Commit 6ab266a

Browse files
committed
Build script improvements
1 parent 0b04181 commit 6ab266a

File tree

5 files changed

+15
-12
lines changed

5 files changed

+15
-12
lines changed

.github/workflows/build.yml

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ jobs:
1212
run: ./init.sh
1313
- name: Build sanoid-portable binary
1414
run: |
15+
# Build on Ubuntu
16+
1517
# Add a new binfmt entry that matches APE's (Actually Portable Executable)'s
1618
# magic number to avoid execution by Ubuntu's built-in "MZ" binfmt
1719
# interpreter which "helpfully" tries to run the binary with WINE.

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
/build/
1+
/output/

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ Build the executable:
6767

6868
This script will download and configure APPerl, download necessary Perl modules, and build the portable Sanoid binary.
6969

70-
The executable gets built to `build/sanoid-portable`.
70+
The executable gets built to `output/sanoid-portable`.
7171

7272
## License
7373

build.sh

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash
1+
#!/usr/bin/env bash
22

33
set -euo pipefail
44

@@ -12,13 +12,13 @@ echo "Building sanoid-portable version ${SANOID_PORTABLE_VERSION}, based on Sano
1212
repo_root="$(realpath "$(dirname "$0")")"
1313

1414
# Cleanup previous artifacts if they exist
15-
if [ -d build ]; then
16-
echo 'Cleaning up previous build...'
17-
rm -rf build
15+
if [ -d output ]; then
16+
echo 'Cleaning up previous build output...'
17+
rm -rf output
1818
fi
1919

20-
mkdir build
21-
pushd build > /dev/null
20+
mkdir output
21+
pushd output > /dev/null
2222

2323
echo 'Downloading necessary modules...'
2424

init.sh

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1-
#!/bin/bash
1+
#!/usr/bin/env bash
22

33
set -euo pipefail
44

55
# Identify the operating system from /etc/os-release
6-
OS=$(grep ^ID= /etc/os-release | cut -d '=' -f 2 | tr -d '"')
6+
source /etc/os-release
7+
OS=$ID
78

8-
# Check if the OS is Debian or a Debian derivative (like Ubuntu)
9+
# The only build OS's we've tested.
910
if [[ "$OS" != 'debian' && "$OS" != 'ubuntu' ]]; then
10-
echo 'Error: This script is intended only for Debian-based systems.'
11+
echo "Error: Unsupported operating system. This script only supports Debian and Ubuntu."
1112
exit 1
1213
fi
1314

0 commit comments

Comments
 (0)