選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

42 行
1.2 KiB

  1. #!/usr/bin/env bash
  2. # Exit the script if any of the commands fail
  3. set -e
  4. set -u
  5. set -o pipefail
  6. # Set working directory to the location of this script
  7. cd "$(dirname "${BASH_SOURCE[0]}")"
  8. STARTDIR="$(pwd)"
  9. DESTDIR="$STARTDIR/pkg"
  10. OUTDIR="$STARTDIR/deb"
  11. # get version
  12. repo="azlux/log2ram"
  13. api=$(curl --silent "https://api.github.com/repos/$repo/releases/latest")
  14. new=$(echo $api | grep -Po '"tag_name": "\K.*?(?=")')
  15. # Remove potential leftovers from a previous build
  16. rm -rf "$DESTDIR" "$OUTDIR"
  17. ## log2ram
  18. # Create directory
  19. install -Dm 644 "$STARTDIR/log2ram.service" "$DESTDIR/etc/systemd/system/log2ram.service"
  20. install -Dm 755 "$STARTDIR/log2ram" "$DESTDIR/usr/local/bin/log2ram"
  21. install -Dm 644 "$STARTDIR/log2ram.conf" "$DESTDIR/etc/log2ram.conf"
  22. install -Dm 644 "$STARTDIR/uninstall.sh" "$DESTDIR/usr/local/bin/uninstall-log2ram.sh"
  23. # cron
  24. install -Dm 755 "$STARTDIR/log2ram.cron" "$DESTDIR/etc/cron.daily/log2ram"
  25. install -Dm 644 "$STARTDIR/log2ram.logrotate" "$DESTDIR/etc/logrotate.d/log2ram"
  26. # Build .deb
  27. mkdir "$DESTDIR/DEBIAN" "$OUTDIR"
  28. cp "$STARTDIR/debian/"* "$DESTDIR/DEBIAN/"
  29. # Set version
  30. sed -i "s/VERSION-TO-REPLACE/$new/" "$DESTDIR/DEBIAN/control"
  31. dpkg-deb --build "$DESTDIR" "$OUTDIR"