summarylogtreecommitdiffstats
path: root/generate_install.sh
blob: 9499ed2596de76b1c17638680308faa83efd1ed6 (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
#!/usr/bin/env sh
found=0
IFS=''
cat PKGBUILD | while read line; do
  if [[ found -eq 0 ]]; then
    if [[ "$line" == pkgname=* ]]; then
      echo "#==> Auto-generated file from PKGBUILD <==#" > .install
      echo $line >> .install
    elif [ "$line" = "#==> Custom <==#" ]; then
      found=1
    fi
  else
    if [[ "$line" == _remove_package* ]]; then
      echo "post_remove() {" >> .install
    elif [ "$line" != "#==> End of custom <==#" ]; then
      echo $line >> .install
    else
      break
    fi
  fi
done
if [[ found -eq 1 ]]; then
  echo "Error parsing PKGBUILD"
  exit 1
fi