From bd585703b033b68ff43a7c7b48b362bd44905e04 Mon Sep 17 00:00:00 2001 From: Jan Starke Date: Mon, 5 Feb 2024 09:54:50 +0100 Subject: [PATCH] initial deb creation with autocomplete --- Cargo.toml | 3 +++ scripts/maintainer/postinst | 30 ++++++++++++++++++++++++++++++ scripts/maintainer/prerm | 4 ++++ scripts/update-autocomplete.sh | 13 +++++++++++++ 4 files changed, 50 insertions(+) create mode 100644 scripts/maintainer/postinst create mode 100644 scripts/maintainer/prerm create mode 100755 scripts/update-autocomplete.sh diff --git a/Cargo.toml b/Cargo.toml index 32f34b7..29b93cb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,6 +7,9 @@ description = "CLI tools for digital forensics and incident response" homepage = "https://www.github.com/dfir-dd/dfir_toolkit" license = "GPL-3.0" +[package.metadata.deb] +maintainer-scripts = "scripts/maintainer" + [[bin]] name = "mactime2" path = "src/bin/mactime2/main.rs" diff --git a/scripts/maintainer/postinst b/scripts/maintainer/postinst new file mode 100644 index 0000000..17ee79d --- /dev/null +++ b/scripts/maintainer/postinst @@ -0,0 +1,30 @@ +#!/bin/bash +mkdir -p /usr/local/share/zsh/site-functions +cleanhive --autocomplete bash >/etc/bash_completion.d/dfir-dd_cleanhive +cleanhive --autocomplete zsh >/usr/local/share/zsh/site-functions/dfir-dd_cleanhive +es4forensics --autocomplete bash >/etc/bash_completion.d/dfir-dd_es4forensics +es4forensics --autocomplete zsh >/usr/local/share/zsh/site-functions/dfir-dd_es4forensics +evtx2bodyfile --autocomplete bash >/etc/bash_completion.d/dfir-dd_evtx2bodyfile +evtx2bodyfile --autocomplete zsh >/usr/local/share/zsh/site-functions/dfir-dd_evtx2bodyfile +evtxanalyze --autocomplete bash >/etc/bash_completion.d/dfir-dd_evtxanalyze +evtxanalyze --autocomplete zsh >/usr/local/share/zsh/site-functions/dfir-dd_evtxanalyze +evtxcat --autocomplete bash >/etc/bash_completion.d/dfir-dd_evtxcat +evtxcat --autocomplete zsh >/usr/local/share/zsh/site-functions/dfir-dd_evtxcat +evtxls --autocomplete bash >/etc/bash_completion.d/dfir-dd_evtxls +evtxls --autocomplete zsh >/usr/local/share/zsh/site-functions/dfir-dd_evtxls +evtxscan --autocomplete bash >/etc/bash_completion.d/dfir-dd_evtxscan +evtxscan --autocomplete zsh >/usr/local/share/zsh/site-functions/dfir-dd_evtxscan +hivescan --autocomplete bash >/etc/bash_completion.d/dfir-dd_hivescan +hivescan --autocomplete zsh >/usr/local/share/zsh/site-functions/dfir-dd_hivescan +ipgrep --autocomplete bash >/etc/bash_completion.d/dfir-dd_ipgrep +ipgrep --autocomplete zsh >/usr/local/share/zsh/site-functions/dfir-dd_ipgrep +lnk2bodyfile --autocomplete bash >/etc/bash_completion.d/dfir-dd_lnk2bodyfile +lnk2bodyfile --autocomplete zsh >/usr/local/share/zsh/site-functions/dfir-dd_lnk2bodyfile +mactime2 --autocomplete bash >/etc/bash_completion.d/dfir-dd_mactime2 +mactime2 --autocomplete zsh >/usr/local/share/zsh/site-functions/dfir-dd_mactime2 +pol_export --autocomplete bash >/etc/bash_completion.d/dfir-dd_pol_export +pol_export --autocomplete zsh >/usr/local/share/zsh/site-functions/dfir-dd_pol_export +regdump --autocomplete bash >/etc/bash_completion.d/dfir-dd_regdump +regdump --autocomplete zsh >/usr/local/share/zsh/site-functions/dfir-dd_regdump +ts2date --autocomplete bash >/etc/bash_completion.d/dfir-dd_ts2date +ts2date --autocomplete zsh >/usr/local/share/zsh/site-functions/dfir-dd_ts2date diff --git a/scripts/maintainer/prerm b/scripts/maintainer/prerm new file mode 100644 index 0000000..f4e3f2b --- /dev/null +++ b/scripts/maintainer/prerm @@ -0,0 +1,4 @@ +#!/bin/bash + +rm -f /etc/bash_completion.d/dfir-dd* +rm -f /usr/local/share/zsh/site-functions/dfir-dd* diff --git a/scripts/update-autocomplete.sh b/scripts/update-autocomplete.sh new file mode 100755 index 0000000..660f9d4 --- /dev/null +++ b/scripts/update-autocomplete.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +DIR=$( cd -- "$( dirname "${BASH_SOURCE[0]}" )" && pwd) + +mkdir -p $DIR/maintainer +echo '#!/bin/bash' >$DIR/maintainer/postinst + +echo 'mkdir -p /usr/local/share/zsh/site-functions' >>$DIR/maintainer/postinst + +for B in $(cd src/bin; echo *); do + echo "$B --autocomplete bash >/etc/bash_completion.d/dfir-dd_$B" >>$DIR/maintainer/postinst + echo "$B --autocomplete zsh >/usr/local/share/zsh/site-functions/dfir-dd_$B" >>$DIR/maintainer/postinst +done \ No newline at end of file