From ff810caf10c4cc12dd1782948dc7c2010a24bdad Mon Sep 17 00:00:00 2001 From: Albert S Date: Sun, 9 Apr 2023 15:59:54 +0200 Subject: [PATCH] packages: Move remove(), pre_install(), post_install() to debfetcher --- debfetcher.sh | 24 ++++++++++++++++++++++++ packages/brave.debfetcher | 27 --------------------------- packages/signal.debfetcher | 23 ----------------------- packages/spotify.debfetcher | 23 ----------------------- 4 files changed, 24 insertions(+), 73 deletions(-) diff --git a/debfetcher.sh b/debfetcher.sh index eccfaae..8234477 100755 --- a/debfetcher.sh +++ b/debfetcher.sh @@ -88,6 +88,30 @@ verify_sig() +# default presets for templates +remove() +{ + rm -rf -- "${DEBFETCHER_INSTALL_DESTDIR}/${THIS_BASEDIR}" +} + +pre_install() +{ + CURRENT_DIR="${DEBFETCHER_INSTALL_DESTDIR}${THIS_BASEDIR}" + if [ -d "${CURRENT_DIR}" ] ; then + mv -- "${DEBFETCHER_INSTALL_DESTDIR}${THIS_BASEDIR}" "${DEBFETCHER_INSTALL_DESTDIR}${THIS_BASEDIR}_${TS}" + fi +} + +post_install() +{ + if [ ${KEEP_OLD} -eq 0 ] ; then + rm -rf -- "${DEBFETCHER_INSTALL_DESTDIR}${THIS_BASEDIR}_${TS}" + fi +} + + + + debfetcher_install() { TEMPLATE_NAME=$(basename "$1") diff --git a/packages/brave.debfetcher b/packages/brave.debfetcher index a9cfa6c..52318f8 100644 --- a/packages/brave.debfetcher +++ b/packages/brave.debfetcher @@ -7,22 +7,6 @@ PACKAGE="brave-browser" TS=$(date +%s) THIS_BASEDIR="/opt/brave.com" -remove() -{ - rm -rf -- "${DEBFETCHER_INSTALL_DESTDIR}/${THIS_BASEDIR}" -} - -pre_install() -{ - - CURRENT_DIR="${DEBFETCHER_INSTALL_DESTDIR}${THIS_BASEDIR}" - - if [ -d "${CURRENT_DIR}" ] ; then - mv -- "${DEBFETCHER_INSTALL_DESTDIR}${THIS_BASEDIR}" "${DEBFETCHER_INSTALL_DESTDIR}${THIS_BASEDIR}_${TS}" - fi - -} - install() { cp -a --parents -- opt/brave.com "${DEBFETCHER_INSTALL_DESTDIR}" @@ -31,14 +15,3 @@ install() } - -post_install() -{ - if [ ${KEEP_OLD} -eq 0 ] ; then - rm -rf -- "${DEBFETCHER_INSTALL_DESTDIR}/opt/brave.com_${TS}" - fi - - sourcepath=$(realpath "${DEBFETCHER_INSTALL_DESTDIR}${THIS_BASEDIR}/brave/brave-browser") - ln -sf "${sourcepath}" "${DEBFETCHER_BIN_SYMLINK_DIR}/" - sed -e "s;Exec=/;Exec=${DEBFETCHER_BIN_SYMLINK_DIR};" -i "${DEBFETCHER_INSTALL_DESTDIR}"/usr/share/applications/brave-browser.desktop -} diff --git a/packages/signal.debfetcher b/packages/signal.debfetcher index 17d20bb..e32e796 100644 --- a/packages/signal.debfetcher +++ b/packages/signal.debfetcher @@ -7,21 +7,6 @@ PACKAGE="signal-desktop" TS=$(date +%s) THIS_BASEDIR="/opt/Signal" -remove() -{ - rm -rf -- "${DEBFETCHER_INSTALL_DESTDIR}/${THIS_BASEDIR}" -} - -pre_install() -{ - - CURRENT_DIR="${DEBFETCHER_INSTALL_DESTDIR}${THIS_BASEDIR}" - - if [ -d "${CURRENT_DIR}" ] ; then - mv -- "${DEBFETCHER_INSTALL_DESTDIR}${THIS_BASEDIR}" "${DEBFETCHER_INSTALL_DESTDIR}${THIS_BASEDIR}_${TS}" - fi -} - install() { #Inspired by Gentoo's ebuild @@ -34,11 +19,3 @@ install() ln -sf ${DEBFETCHER_INSTALL_DESTDIR}/opt/Signal/signal-desktop "${DEBFETCHER_BIN_SYMLINK_DIR}" } - - -post_install() -{ - if [ ${KEEP_OLD} -eq 0 ] ; then - rm -rf -- "${DEBFETCHER_INSTALL_DESTDIR}${THIS_BASEDIR}_${TS}" - fi -} diff --git a/packages/spotify.debfetcher b/packages/spotify.debfetcher index 738e307..4285205 100644 --- a/packages/spotify.debfetcher +++ b/packages/spotify.debfetcher @@ -7,21 +7,6 @@ PACKAGE="spotify-client" TS=$(date +%s) THIS_BASEDIR="/opt/spotify" -remove() -{ - rm -rf -- "${DEBFETCHER_INSTALL_DESTDIR}/${THIS_BASEDIR}" -} - -pre_install() -{ - - CURRENT_DIR="${DEBFETCHER_INSTALL_DESTDIR}${THIS_BASEDIR}" - - if [ -d "${CURRENT_DIR}" ] ; then - mv -- "${DEBFETCHER_INSTALL_DESTDIR}${THIS_BASEDIR}" "${DEBFETCHER_INSTALL_DESTDIR}${THIS_BASEDIR}_${TS}" - fi -} - install() { mkdir -p ${DEBFETCHER_INSTALL_DESTDIR}/${THIS_BASEDIR} @@ -30,11 +15,3 @@ install() ln -sf ${DEBFETCHER_INSTALL_DESTDIR}/opt/spotify/spotify "${DEBFETCHER_BIN_SYMLINK_DIR}" } - - -post_install() -{ - if [ ${KEEP_OLD} -eq 0 ] ; then - rm -rf -- "${DEBFETCHER_INSTALL_DESTDIR}${THIS_BASEDIR}_${TS}" - fi -}