forked from nefelim4ag/Ananicy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
package.sh
executable file
·52 lines (46 loc) · 1.73 KB
/
package.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/bash -e
################################################################################
# echo wrappers
INFO(){ echo "INFO: $*";}
WARN(){ echo "WARN: $*";}
ERRO(){ echo "ERRO: $*"; exit 1;}
debian_package(){
cd "$(dirname "$0")"
VERSION=$(git tag --sort version:refname | tail -n 1)
[ -z "$VERSION" ] && ERRO "Can't get git tag, VERSION are empty!"
DEB_NAME="ananicy-${VERSION}_any"
# cleanup after previous installation
rm "./${DEB_NAME}.deb" && rm -rf "${DEB_NAME}"
mkdir -p "${DEB_NAME}"
make install PREFIX="${DEB_NAME}"
mkdir -p "${DEB_NAME}/DEBIAN/"
{
echo "Package: ananicy"
echo "Version: $VERSION"
echo "Section: custom"
echo "Priority: optional"
echo "Architecture: all"
echo "Depends: coreutils, schedtool"
echo "Essential: no"
echo "Installed-Size: 16"
echo "Maintainer: [email protected]"
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)."
} > "${DEB_NAME}/DEBIAN/control"
POSTINST="${DEB_NAME}/DEBIAN/postinst"
touch "${POSTINST}" && chmod +x "${POSTINST}"
{
echo "#!/bin/sh"
echo "chown -R root:root /etc/ananicy.d"
echo "chown root:root /lib/systemd/system/ananicy.service"
echo "chown root:root /usr/bin/ananicy"
} > "${POSTINST}"
dpkg-deb --build "${DEB_NAME}"
}
archlinux_package(){
INFO "Use yaourt -S ananicy-git"
}
case $1 in
debian) debian_package ;;
archlinux) archlinux_package ;;
*) echo "$0 <debian|archlinux>" ;;
esac