Skip to content
This repository was archived by the owner on Oct 23, 2023. It is now read-only.

Commit 9e989fb

Browse files
kfeoktistoffnefelim4ag
authored andcommitted
Post-install script for the deb package added
* Ownership of the system files changed to 'root:root' * Bash variables enquoted to make them more secure
1 parent d6f299b commit 9e989fb

File tree

1 file changed

+19
-6
lines changed

1 file changed

+19
-6
lines changed

package.sh

+19-6
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,14 @@ debian_package(){
99
cd "$(dirname "$0")"
1010
VERSION=$(git tag --sort version:refname | tail -n 1)
1111
[ -z "$VERSION" ] && ERRO "Can't get git tag, VERSION are empty!"
12-
DEB_NAME=ananicy-${VERSION}_any
13-
mkdir -p "$DEB_NAME"
14-
make install PREFIX="$DEB_NAME"/
15-
mkdir -p "$DEB_NAME"/DEBIAN/
12+
DEB_NAME="ananicy-${VERSION}_any"
13+
14+
# cleanup after previous installation
15+
rm "./${DEB_NAME}.deb" && rm -rf "${DEB_NAME}"
16+
17+
mkdir -p "${DEB_NAME}"
18+
make install PREFIX="${DEB_NAME}"
19+
mkdir -p "${DEB_NAME}/DEBIAN/"
1620
{
1721
echo "Package: ananicy"
1822
echo "Version: $VERSION"
@@ -24,8 +28,17 @@ debian_package(){
2428
echo "Installed-Size: 16"
2529
echo "Maintainer: [email protected]"
2630
echo "Description: Ananicy (ANother Auto NICe daemon) — is a shell daemon created to manage processes' IO and CPU priorities, with community-driven set of rules for popular applications (anyone may add his own rule via github's pull request mechanism)."
27-
} > "$DEB_NAME"/DEBIAN/control
28-
dpkg-deb --build "$DEB_NAME"
31+
} > "${DEB_NAME}/DEBIAN/control"
32+
33+
POSTINST="${DEB_NAME}/DEBIAN/postinst"
34+
touch "${POSTINST}" && chmod +x "${POSTINST}"
35+
{
36+
echo "#!/bin/sh"
37+
echo "chown -R root:root /etc/ananicy.d"
38+
echo "chown root:root /lib/systemd/system/ananicy.service"
39+
echo "chown root:root /usr/bin/ananicy"
40+
} > "${POSTINST}"
41+
dpkg-deb --build "${DEB_NAME}"
2942
}
3043

3144
archlinux_package(){

0 commit comments

Comments
 (0)