#!/bin/sh
dpath_script="$(dirname "$0")"
if uname -s | grep -q 'Linux' && which systemd > /dev/null 2>&1 && which python3 > /dev/null 2>&1
then
cp -vf "$dpath_script/systemd-autohibernated" /usr/local/bin/systemd-autohibernated
chown 0:0 /usr/local/bin/systemd-autohibernated
chmod u=rwx,go=rx /usr/local/bin/systemd-autohibernated
cp -vf "$dpath_script/systemd-autohibernated.service" /etc/systemd/system/systemd-autohibernated.service
systemctl enable systemd-autohibernated.service
systemctl start systemd-autohibernated.service
else
printf "> error: This software requires a systemd-based Linux distribution with Python 3.\n"
fi