-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·47 lines (36 loc) · 1.08 KB
/
install.sh
File metadata and controls
executable file
·47 lines (36 loc) · 1.08 KB
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
#!/usr/bin/env bash
# Stop when errors
set -euo pipefail
MAKEFILES_PREFIX=".modules"
MAKEFILECORE_FILE="$MAKEFILES_PREFIX/core.mk"
MAKEFILE_CORE_URL=https://raw.githubusercontent.com/w5s/makefile-core/main/core.mk
INCLUDE_TEMPLATE="include $MAKEFILECORE_FILE"
# Download core module
mkdir -p $MAKEFILES_PREFIX
curl -fsSL -o "$MAKEFILECORE_FILE" "$MAKEFILE_CORE_URL"
# Update Makefile
touch Makefile
if ! grep "$INCLUDE_TEMPLATE" Makefile > /dev/null; then
MAKEFILE_CONTENT=$(cat Makefile)
cat << EOF > Makefile
# Include Core
# The following files will be included before
# 1. Makefile.local (⚠️ This file should never be versioned)
# 2. Makefile.config
# 3. .modules/core.mk (default values)
# 4. .modules/*/module.mk
$INCLUDE_TEMPLATE
$MAKEFILE_CONTENT
EOF
fi
if [[ ! -f Makefile.config ]]; then
cat << EOF > Makefile.config
# Makefile configuration
# Upstream for core.mk used by make self-update
export MAKEFILE_CORE_URL := $MAKEFILE_CORE_URL
# Project name (ex: vesta)
# export CI_PROJECT_NAME ?= <TODO>
# Project namespace (ex: w5s)
# export CI_PROJECT_NAMESPACE ?= <TODO>
EOF
fi