aboutsummaryrefslogtreecommitdiff
path: root/cmd/build-all.sh
blob: b626592496a321cf53f549d51517880dfba75fbb (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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/bin/sh

CMD_DIR="$(realpath $(dirname $0))"
PATH=$PATH:$CMD_DIR
PROJ_DIR="$(realpath $CMD_DIR/..)"

while :
do
  >"$TMP/before.txt" find  "${PROJ_DIR}" -name '*.txz'
  mkdir -p "${PROJ_DIR}/patches/packages/"
 for pkg in $PROJ_DIR/patches/source/*; do
    (
      cd "$pkg"

      export OUTPUT="${PROJ_DIR}/patches/packages/"
      PKG_NAME=$(basename $(realpath .))

      built=$(find "$OUTPUT" -name "$PKG_NAME-*.txz")
      if [ -n "$built" ]; then
        continue
      fi

      sh *.SlackBuild
      built="$(find "$TMP" -name "*.txz")"
      if [ -z "$built" ]; then
        continue
      fi
      mkdir -p "${OUTPUT}"
      upgradepkg --install-new "$TMP"/*.txz
      mv "$TMP"/*.txz "${OUTPUT}"
      )
  done

  for pkg in $PROJ_DIR/source/**/*; do
    (
      cd "$pkg"

      export OUTPUT="${PROJ_DIR}/slackware/$(pkg-set.sh)"
      PKG_NAME=$(basename $(realpath .))

      built=$(find "$OUTPUT" -name "$PKG_NAME-*.txz")
      if [ -n "$built" ]; then
        continue
      fi

      sh *.SlackBuild
      built="$(find "$TMP" -name "*.txz")"
      if [ -z "$built" ]; then
        continue
      fi
      mkdir -p "${OUTPUT}"
      upgradepkg --install-new "$TMP"/*.txz
      mv "$TMP"/*.txz "${OUTPUT}"
      )
  done
  >"$TMP/after.txt" find  "${PROJ_DIR}" -name '*.txz'

  NEW_PACKAGES="$(diff $TMP/before.txt $TMP/after.txt | grep "^>" | sed "s#^> ##")"
  if [ ! $NEW_PACKAGES ]; then
    break
  fi
done