feat: add deb, pkgbuild, completion, code improvements

This commit is contained in:
ge
2022-10-09 03:29:35 +03:00
parent 8999940443
commit ce07669a6e
11 changed files with 167 additions and 13 deletions

View File

@ -5,7 +5,7 @@ BUILD_DIR := ./dist
.PHONY: help tests manpages install uninstall fixpath
all: manpages
all: help
help:
@echo 'Usage: make TARGET'
@ -55,7 +55,7 @@ html: manpages
> $(BUILD_DIR)/share/doc/boring_backup/boring_backup.1.html 2>/dev/null
rm -v grohtml-*.png
install: manpages
install: html
@echo prefix: $$prefix
install -Dm755 $(SRC_DIR)/boring_backup $$prefix/bin/boring_backup
install -Dm644 $(SRC_DIR)/lib/lib.sh $$prefix/share/boring_backup/lib.sh
@ -71,7 +71,11 @@ install: manpages
sed -e "s%LIBRARY=\"\$${LIBRARY:-.\/lib}\"%LIBRARY=\"\$${LIBRARY:-$$prefix\/share\/boring_backup}\"%" \
-i $$prefix/share/boring_backup/lib.sh \
-i $$prefix/bin/boring_backup
sed -e "s%log_file=\"\$${log_file:-.\/log.txt}\"%log_file=\"\$${log_file:-\/var\/log\/boring_backup.log}\"%g" \
-i $$prefix/bin/boring_backup
install -Dm664 $(SRC_DIR)/completion $$prefix/share/bash-completion/completions/boring_backup
install -Dm664 $(BUILD_DIR)/share/man/ru/man1/boring_backup.1.gz $$prefix/share/man/ru/man1/boring_backup.1.gz
install -Dm644 $(BUILD_DIR)/share/doc/boring_backup/boring_backup.1.html $$prefix/share/doc/boring_backup/boring_backup.1.html
uninstall:
@echo prefix: $$prefix
@ -88,11 +92,24 @@ uninstall:
rm $$prefix/share/boring_backup/handlers/targets/s3cmd.sh
rm -rv $$prefix/share/boring_backup
rm $$prefix/share/man/ru/man1/boring_backup.1.gz
rm $$prefix/share/doc/boring_backup/boring_backup.1.html
rm $$prefix/share/bash-completion/completions/boring_backup
fixpath:
# Set boring_backup library path
@echo prefix: $$prefix
@echo path: $$path
sed -e "s%LIBRARY=\"\$${LIBRARY:-.\/lib}\"%LIBRARY=\"\$${LIBRARY:-$$path}\"%" \
sed -e "s%LIBRARY=\"\$${LIBRARY:-$$prefix\/share\/boring_backup}\"%LIBRARY=\"\$${LIBRARY:-$$path}\"%" \
-i $$prefix/share/boring_backup/lib.sh \
-i $$prefix/bin/boring_backup
deb:
test -d $(BUILD_DIR) && rm -rf $(BUILD_DIR) || true
make prefix=$(BUILD_DIR)/usr install
make prefix=$(BUILD_DIR)/usr path=/usr/share/boring_backup fixpath
install -Dm644 control $(BUILD_DIR)/DEBIAN/control
install -Dm644 copyright $(BUILD_DIR)/DEBIAN/copyright
install -Dm644 CHANGELOG $(BUILD_DIR)/DEBIAN/changelog
rm -rfv $(BUILD_DIR)/share
mkdir -p debian
version=$$(src/boring_backup -V) && dpkg-deb --build $(BUILD_DIR) debian/boring-backup_$$version.deb