aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEinhard Leichtfuß <alguien@respiranto.de>2018-03-30 22:08:42 +0200
committerEinhard Leichtfuß <alguien@respiranto.de>2018-03-30 22:08:42 +0200
commit2a7eb7221b85af3f2c5141c3918ff1959566f55a (patch)
treefd6725c155ab0e8ef8e6ef7383d1ab2d66ca359c /src
parent9d45fe6b329cbae295ed83d90dd20c5fc3e70717 (diff)
Split some functionality off update.sh
Such that it may be used by the to be bettered make_install.sh. In particular, the latter is supposed to work for both non-vcs source and binary packages. Also add a main() method to update.sh.
Diffstat (limited to 'src')
-rwxr-xr-xsrc/make_install.sh15
-rw-r--r--src/sample.install78
2 files changed, 0 insertions, 93 deletions
diff --git a/src/make_install.sh b/src/make_install.sh
deleted file mode 100755
index a24837f..0000000
--- a/src/make_install.sh
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/bin/bash
-
-if [ "$#" -lt 1 ]
-then
- echo "Usage: $0 xy-zw [base_dir]" >&2
- exit 1
-elif [ "$#" -gt 1 ]
-then
- cd "$2" || exit 1
-fi
-
-lang=$1
-pkgname=dict-freedict-${lang}
-
-sed "s/%LANG%/${lang}/g" sample.install > ${pkgname}/${pkgname}.install
diff --git a/src/sample.install b/src/sample.install
deleted file mode 100644
index 882fbf5..0000000
--- a/src/sample.install
+++ /dev/null
@@ -1,78 +0,0 @@
-basename=%LANG%
-pkgname=dict-freedict-$basename
-dictd_conf=/etc/dict/dictd.conf
-datadir=/usr/share/dictd
-conf="database $basename {
- data $datadir/$basename.dict.dz
- index $datadir/$basename.index
-}"
-
-post_install()
-{
- echo
- if pacman -Qq dictd > /dev/null 2>&1
- then
- if grep -q "^database *$basename" "$dictd_conf"
- then
- echo "$pkgname already configured in $dictd_conf"
- else
- echo "Adding configuration for $pkgname to $dictd_conf"
- echo "$conf" >> "$dictd_conf"
- fi
-
- if systemctl -q is-active dictd.service
- then
- echo "Restarting dictd service in order to" \
- "use the new dictionary database"
- systemctl restart dictd.service
- else
- echo "Starting dictd service in order to" \
- "use the new dictionary database"
- systemctl start dictd.service
- fi
- else
- echo "dictd does not appear to be installed."
- echo "In order to use this database you should either" \
- "install dictd or alternatively" \
- "another dict server and configure it on your own."
- fi
- echo
-}
-
-post_upgrade()
-{
- if pacman -Qq dictd > /dev/null 2>&1 && \
- systemctl -q is-active dictd.service
- then
- echo -e "\nRestarting dictd service in order to" \
- "use the updated dictionary database"
- systemctl restart dictd.service
- fi
-}
-
-post_remove()
-{
- if pacman -Qq dictd > /dev/null 2>&1
- then
- current_conf="$(grep -A 3 "^database *$basename" "$dictd_conf")"
- if test -n "$current_conf"
- then
- echo
- if test "$current_conf" = "$conf"
- then
- echo "Removing configuration for $pkgname from $dictd_conf"
- sed -i "/database $basename {/,/}/d" "$dictd_conf"
- else
- echo "User created / modified configuration" \
- "for $pkgname in $dictd_conf is left untouched."
- fi
- fi
-
- if systemctl -q is-active dictd.service
- then
- echo "Restarting dictd service in order to" \
- "stop using the removed dictionary database"
- systemctl restart dictd.service
- fi
- fi
-}