summaryrefslogtreecommitdiffstats
path: root/release-utils/make-release-zip.sh
blob: 8010b1f102b09c0f1c561bdfc78b8703e08878ad (plain)
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
#!/bin/bash

# We use the immutable filesystem attribute as a workaround for the fact that
# the build scripts are not currently idempotent.

# The fact that the package is marked immutable means that it has been built
# for release.

if ! lsattr "$PREPKG" | cut -f 1 -d" " | grep -q i ; then

  if [ -f "$PREPKG" ] ; then
    echo "$PREPKG" is not immutable, rebuilding it for release!
  else
    echo building "$PREPKG" for the first time...
  fi

  if ! release-utils/make-eff-zip.sh "$GITTAG" ; then
    echo "Failed to build target $GITTAG"
    exit 1
  fi

  if ! [ -f "$PREPKG" -a -f "$PREPKGCWS" ] ; then
    echo "Failed to find package $PREPKG after build"
    exit 1
  fi

  # Verification and testing of build goes here!

  echo Marking "$PREPKG" immutable...
  if ! sudo true ; then
    echo "Failed to sudo :("
    exit 1
  fi
  if ! sudo chattr +i "$PREPKG" "$PREPKGCWS"; then
    echo ""
    echo "WARNING: FAILED TO MARK $PREPKG or $PREPKGCWS IMMUTABLE."
    echo "DO NOT RERUN THIS SCRIPT AFTER SIGNING"
    echo ""
    read -p "(Press Enter to acknowledge)"
  fi
else
  echo "$PREPKG is immutable; good, not rebuilding it..."
fi