-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy path2_create.sh
executable file
·54 lines (46 loc) · 1.37 KB
/
2_create.sh
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
#!/usr/bin/env bash
if [ $(id -u) -ne 0 ]; then
echo "Run as superuser"
exit 1
fi
set -e
# this script creates the ostree from ./tree
TREE=${TREE:=./tree}
REPO=${REPO:=./repo}
OUT_TAG=${OUT_TAG:=master}
# # Due to using a buildah mount this is not required
# # Create a temporary container to pull the
# # so we can mount for SELinux
# Create an ostree repo
if [ -n "$INIT_REPO" ] | [ ! -d "$REPO" ]; then
echo
echo "Initializing OSTree repo"
rm -rf $REPO
ostree --repo=$REPO init --mode=bare-user
# Set option to reduce fsync for transient builds
ostree --repo=$REPO config set 'core.fsync' 'false'
fi
echo
echo Creating repo with ref "$OUT_TAG"
# Ingest previous tree dir
ostree --repo=$REPO commit \
-b $OUT_TAG \
--tree=dir=$TREE \
--bootable \
--selinux-policy=$TREE \
--selinux-labeling-epoch=1
if [ -n "$RESET_TIMESTAMP" ]; then
# Touch files for reproducibility
# Should only run as part of the github
# action, not locally. If the action
# runs the touch on the mount, it
# runs out of space.
TIMESTAMP=${TIMESTAMP:=197001010100}
echo
echo Touching files with timestamp $TIMESTAMP for reproducibility
# Also remove user.overlay.impure, which comes from somewhere
find $REPO/ \
-exec touch -t $TIMESTAMP -h {} + \
&> /dev/null || true
fi
echo Commited ref "$OUT_TAG" to repo "$REPO"