diff --git a/ananicy.d/00-default/ark.rules b/ananicy.d/00-default/ark.rules new file mode 100644 index 00000000..a5931424 --- /dev/null +++ b/ananicy.d/00-default/ark.rules @@ -0,0 +1,3 @@ +# ark KDE archiver +{"name": "ark", "type": "BG_CPUIO"} + diff --git a/ananicy.d/00-default/bash.rules b/ananicy.d/00-default/bash.rules new file mode 100644 index 00000000..6704b9e0 --- /dev/null +++ b/ananicy.d/00-default/bash.rules @@ -0,0 +1,2 @@ +# Bash +{ "name": "bash", "type": "Doc-View" } diff --git a/ananicy.d/00-default/konsole.rules b/ananicy.d/00-default/konsole.rules new file mode 100644 index 00000000..fbf3d5e8 --- /dev/null +++ b/ananicy.d/00-default/konsole.rules @@ -0,0 +1,2 @@ +# Konsole +{ "name": "konsole", "type": "Doc-View" } diff --git a/ananicy.d/00-default/minidlna.rules b/ananicy.d/00-default/minidlna.rules new file mode 100644 index 00000000..ee25e05c --- /dev/null +++ b/ananicy.d/00-default/minidlna.rules @@ -0,0 +1,2 @@ +# minidlna +{ "name": "minidlnad", "type": "Chat" } diff --git a/ananicy.d/00-default/okular.rules b/ananicy.d/00-default/okular.rules new file mode 100644 index 00000000..4c0d5652 --- /dev/null +++ b/ananicy.d/00-default/okular.rules @@ -0,0 +1,2 @@ +# Okular PDF KDE reader +{ "name": "okular", "type": "Doc-View" } diff --git a/ananicy.d/00-default/packaged.rules b/ananicy.d/00-default/packaged.rules new file mode 100644 index 00000000..2a7b30c0 --- /dev/null +++ b/ananicy.d/00-default/packaged.rules @@ -0,0 +1,3 @@ +# PackageManager +{ "name": "packaged", "type": "BG_CPUIO" } +{ "name": "packagemanagerd", "type": "BG_CPUIO" } diff --git a/ananicy.d/00-default/unbound.rules b/ananicy.d/00-default/unbound.rules new file mode 100644 index 00000000..9999f971 --- /dev/null +++ b/ananicy.d/00-default/unbound.rules @@ -0,0 +1,2 @@ +# Unbound DNS cache system +{ "name": "unbound", "type": "Doc-View" } diff --git a/ananicy.d/00-default/unison.rules b/ananicy.d/00-default/unison.rules new file mode 100644 index 00000000..8ab3d4f3 --- /dev/null +++ b/ananicy.d/00-default/unison.rules @@ -0,0 +1,5 @@ +# Unison +{ "name": "unison", "type": "BG_CPUIO" } +{ "name": "unison-gtk", "type": "BG_CPUIO" } +{ "name": "unison-2.48.3", "type": "BG_CPUIO" } +{ "name": "unison-2.48.3-gtk", "type": "BG_CPUIO" } diff --git a/ananicy.d/00-default/update.rules b/ananicy.d/00-default/update.rules new file mode 100644 index 00000000..e2417114 --- /dev/null +++ b/ananicy.d/00-default/update.rules @@ -0,0 +1,7 @@ +# system updaters +{ "name": "apt-get", "type": "BG_CPUIO" } +{ "name": "aptitude", "type": "BG_CPUIO" } +{ "name": "zypper", "type": "BG_CPUIO" } + +{ "name": "rpm", "type": "BG_CPUIO" } +{ "name": "dpkg", "type": "BG_CPUIO" } diff --git a/ananicy.d/00-default/vscode.rules b/ananicy.d/00-default/vscode.rules new file mode 100644 index 00000000..f3e25b3e --- /dev/null +++ b/ananicy.d/00-default/vscode.rules @@ -0,0 +1,3 @@ +# VisualStudio Code +{ "name": "code", "type": "Doc-View" } +{ "name": "vscode", "type": "Doc-View" } diff --git a/ananicy.service b/ananicy.service old mode 100644 new mode 100755 index ec565078..eb183577 --- a/ananicy.service +++ b/ananicy.service @@ -8,12 +8,12 @@ ExecStart=/usr/bin/ananicy start Nice=19 SuccessExitStatus=143 OOMScoreAdjust=-999 -Restart=always +Restart=on-failure CPUAccounting=true -MemoryHigh=16M -MemoryMax=64M +#MemoryHigh=16M +#MemoryMax=64M ProtectSystem=true -ProtectHome=true +#ProtectHome=true PrivateTmp=yes [Install] diff --git a/install.sh b/install.sh new file mode 100755 index 00000000..4d6ef8f8 --- /dev/null +++ b/install.sh @@ -0,0 +1,79 @@ +#!/bin/bash +# Copywright - Andre L. R. Madureira - 2018 +# Install dependencies to make Ananicy work inside a Linux Distribution +# +# To add a new distro, just add it below the declare -A +# and type in the command to update and install +# dependencies. If you want to specify different +# dependencies based on the ARCH of the system, just +# type in SUPPORTED_DISTROS[distroname_arch]. Ex: +# SUPPORTED_DISTROS[debian_x86_64]="apt-get ..." +declare -A SUPPORTED_DISTROS + +SUPPORTED_DISTROS[debian]=" +apt-get update && +apt-get install coreutils schedtool make python3" + +SUPPORTED_DISTROS[ubuntu]=" +apt-get update && +apt-get install coreutils schedtool make python3" + +# check if the distro supports systemctl +SERVICE_NAME=ananicy +SYSTEMCTL=$(whereis systemctl | cut -d':' -f2 | tr -s ' ' | xargs | cut -d\ -f1) + +DISTRO="" +ARCH="" + +[ "$(whoami)" != "root" ] && echo -e "\n\tRUN this script as ROOT. Exiting...\n" && exit 1 + +check_distro(){ + # find the distro running + local SUPP_DIST=$(echo ${!SUPPORTED_DISTROS[@]} | tr ' ' '|') + DISTRO=$( + (lsb_release -a ; cat /etc/issue* /etc/*release /proc/version) 2> /dev/null | + tr '[:upper:]' '[:lower:]' | + grep -o -P "($SUPP_DIST)" | + head -n 1 + ) + # check distro architecture + if uname -a | grep -i -P '(amd64|x86_64)' &> /dev/null; then + ARCH=x86_64 + else + ARCH=i386 + fi +} + +install_deps(){ + local PKT_TOOLS=${SUPPORTED_DISTROS[${DISTRO}_${ARCH}]} + if [ -z "$PKT_TOOLS" ]; then + PKT_TOOLS=${SUPPORTED_DISTROS[${DISTRO}]} + fi + eval $PKT_TOOLS +} + +set_autostart(){ + local LOCAL_STATUS=0 + if [ -n "$SYSTEMCTL" ]; then + # use systemctl to autostart ananicy + systemctl daemon-reload && + systemctl enable "$SERVICE_NAME" && + systemctl start "$SERVICE_NAME" + LOCAL_STATUS=$(($LOCAL_STATUS+$?)) + else + # TODO, create SYS V INIT script and remove the + # LOCAL_STATUS=1 below + LOCAL_STATUS=1 + fi + return $LOCAL_STATUS +} + +check_distro +install_deps && +make -j4 install && +set_autostart && +echo -e '\n\tAll went fine, Ananicy Installed with SUCCESS\n' || ( + echo -e '\n\tAnanicy Installation - ERROR\n' + exit 1 +) +