您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

build-packages.sh 1.3 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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 644 "$STARTDIR/log2ram-daily.service" "$DESTDIR/etc/systemd/system/log2ram-daily.service"
  21. install -Dm 644 "$STARTDIR/log2ram-daily.timer" "$DESTDIR/etc/systemd/system/log2ram-daily.timer"
  22. install -Dm 755 "$STARTDIR/log2ram" "$DESTDIR/usr/local/bin/log2ram"
  23. install -Dm 644 "$STARTDIR/log2ram.conf" "$DESTDIR/etc/log2ram.conf"
  24. install -Dm 644 "$STARTDIR/uninstall.sh" "$DESTDIR/usr/local/bin/uninstall-log2ram.sh"
  25. # logrotate
  26. install -Dm 644 "$STARTDIR/log2ram.logrotate" "$DESTDIR/etc/logrotate.d/log2ram"
  27. # Build .deb
  28. mkdir "$DESTDIR/DEBIAN" "$OUTDIR"
  29. cp "$STARTDIR/debian/"* "$DESTDIR/DEBIAN/"
  30. # Set version
  31. sed -i "s/VERSION-TO-REPLACE/$new/" "$DESTDIR/DEBIAN/control"
  32. dpkg-deb --build "$DESTDIR" "$OUTDIR"