Use full paths, add uninstaller
This commit is contained in:
parent
cec73d5096
commit
46b0734609
11
README.txt
11
README.txt
|
@ -5,9 +5,16 @@ Prerequisites:
|
|||
* python3-pyinotify
|
||||
* hdparm
|
||||
|
||||
Installation:
|
||||
sudo ./install
|
||||
Installing:
|
||||
* Run: sudo ./install
|
||||
|
||||
It installs itself to /etc/boot.d and /etc/pm/sleep.d (since disk properties are lost on sleep). This works if your system doesn't use systemd, and you use pm-utils to suspend.
|
||||
|
||||
env contains a bunch of installation-specific settings.
|
||||
|
||||
Uninstalling:
|
||||
* Run: hdd-speen-uninstall
|
||||
|
||||
Running:
|
||||
* Run the daemon: hdd-speen
|
||||
* Apply disk properties and close: hdd-speen --oneshot
|
||||
|
|
3
bin/boot
3
bin/boot
|
@ -1,3 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
DISTRO="$(basename "$(realpath -s "$BASH_SOURCE")")"
|
||||
nohup "$DISTRO" &> /dev/null &
|
|
@ -1,7 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
DISTRO="$(basename "$(realpath -s "$BASH_SOURCE")")"
|
||||
case "$1" in
|
||||
resume|thaw)
|
||||
"$DISTRO" --oneshot
|
||||
;;
|
||||
esac
|
1
env
1
env
|
@ -1,5 +1,4 @@
|
|||
DISTRO="${DISTRO:=hdd-speen}"
|
||||
DISTRO_BOOT="${DISTRO//-/_}"
|
||||
INSTALL_DIR="${INSTALL_DIR:=/usr/local/sbin}"
|
||||
BOOT_DIR="${BOOT_DIR:=/etc/boot.d}"
|
||||
PMUTILS_DIR="${PMUTILS_DIR:=/etc/pm}"
|
||||
|
|
28
install
28
install
|
@ -3,20 +3,38 @@ set -e
|
|||
SCRIPT_DIR="$(dirname "$(realpath -s "$BASH_SOURCE")")"
|
||||
source "$SCRIPT_DIR/env"
|
||||
|
||||
# Main program
|
||||
# Uninstaller
|
||||
mkdir -p "$INSTALL_DIR"
|
||||
echo \
|
||||
'#!/usr/bin/env bash
|
||||
rm "'"$INSTALL_DIR/$DISTRO"'"
|
||||
rm "'"$BOOT_DIR/$DISTRO"'"
|
||||
rm "'"$PMUTILS_DIR/sleep.d/$DISTRO"'"
|
||||
rm "'"$INSTALL_DIR/$DISTRO-uninstall"'"' > "$INSTALL_DIR/$DISTRO-uninstall"
|
||||
chown root "$INSTALL_DIR/$DISTRO-uninstall"
|
||||
chmod 755 "$INSTALL_DIR/$DISTRO-uninstall"
|
||||
|
||||
# Main program
|
||||
cp "$SCRIPT_DIR/bin/main" "$INSTALL_DIR/$DISTRO"
|
||||
chown root "$INSTALL_DIR/$DISTRO"
|
||||
chmod 755 "$INSTALL_DIR/$DISTRO"
|
||||
|
||||
# Boot script
|
||||
mkdir -p "$BOOT_DIR"
|
||||
cp "$SCRIPT_DIR/bin/boot" "$BOOT_DIR/$DISTRO_BOOT"
|
||||
chown root "$BOOT_DIR/$DISTRO_BOOT"
|
||||
chmod 755 "$BOOT_DIR/$DISTRO_BOOT"
|
||||
echo \
|
||||
'#!/usr/bin/env bash
|
||||
nohup "'"$INSTALL_DIR/$DISTRO"'" &> /dev/null &' > "$BOOT_DIR/$DISTRO"
|
||||
chown root "$BOOT_DIR/$DISTRO"
|
||||
chmod 755 "$BOOT_DIR/$DISTRO"
|
||||
|
||||
# Wake script
|
||||
mkdir -p "$PMUTILS_DIR/sleep.d"
|
||||
cp "$SCRIPT_DIR/bin/resume" "$PMUTILS_DIR/sleep.d/$DISTRO"
|
||||
echo \
|
||||
'#!/usr/bin/env bash
|
||||
case "$1" in
|
||||
resume|thaw)
|
||||
"'"$INSTALL_DIR/$DISTRO"'" --oneshot
|
||||
;;
|
||||
esac' > "$PMUTILS_DIR/sleep.d/$DISTRO"
|
||||
chown root "$PMUTILS_DIR/sleep.d/$DISTRO"
|
||||
chmod 755 "$PMUTILS_DIR/sleep.d/$DISTRO"
|
||||
|
|
Loading…
Reference in New Issue