mirror of
https://github.com/tcsenpai/Frappuccino.git
synced 2025-06-02 16:50:09 +00:00
Initial commit
This commit is contained in:
commit
37cb59610e
65
README.md
Normal file
65
README.md
Normal file
@ -0,0 +1,65 @@
|
||||
# Frappuccino
|
||||
|
||||
A dirty response to dev's skill issues in installing Caffeine
|
||||
|
||||
## What is Frappuccino?
|
||||
|
||||
Following the Caffeine, Espresso and so on trend, Frappuccino is probably the most lightweight way to keep your Linux system awake forcefully.
|
||||
|
||||
## Why not Caffeine?
|
||||
|
||||
I am aware that this is probably just a problem of mine, but I can't seem to install Caffeine on Arch for some obscure reason so I wrote my version.
|
||||
|
||||
## How does it work?
|
||||
|
||||
Frappuccino is just a quick wrapper around systemd-inhibit that creates a service and an infinite 2-seconds loop logging in the service logs.
|
||||
The logging loop is the argument to systemd-inhibit that will thus prevent any shutdown/sleep/hibernation to happen.
|
||||
|
||||
## Is it safe / compatible with ...?
|
||||
|
||||
Honestly, who knows. But being an innocent script and provided you don't have any other frappuccino named services, the worse that can happens is that it does not work.
|
||||
|
||||
## Installation
|
||||
|
||||
Clone or download this repository in your /home/username/ directory.
|
||||
|
||||
cd
|
||||
git clone https://github.com/thecookingsenpai/frappuccino
|
||||
cd frappuccino
|
||||
|
||||
Now give the installation file the right permissions and execute it:
|
||||
|
||||
chmod +x install.sh
|
||||
./install.sh
|
||||
|
||||
Done!
|
||||
|
||||
## Management
|
||||
|
||||
To inspect the service:
|
||||
|
||||
sudo systemctl status frappuccino
|
||||
|
||||
This should show you some logs lines with the most recent timestamp.
|
||||
|
||||
To start/stop the service:
|
||||
|
||||
sudo systemctl start frappuccino
|
||||
sudo systemctl stop frappuccino
|
||||
sudo systemctl restart frappuccino
|
||||
|
||||
The service is automatically enabled for autostart. You can remove it with:
|
||||
|
||||
sudo systemctl disable frappuccino
|
||||
|
||||
And, vice versa:
|
||||
|
||||
sudo systemctl enable frappuccino
|
||||
|
||||
## Performances and workload
|
||||
|
||||
Having a 2 seconds sleep, this script is basically guaranteed to have 0 impact on performance even on small systems like a Raspberry Pi 0 (on which I am aware isn't needed but you get the point).
|
||||
|
||||
## License
|
||||
|
||||
This software is released under the CC BY-NC-SA 4.0 License.
|
15
frappuccino.service
Normal file
15
frappuccino.service
Normal file
@ -0,0 +1,15 @@
|
||||
|
||||
[Unit]
|
||||
Description=Frappuccino daemon
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
|
||||
# Service execution
|
||||
###################
|
||||
|
||||
ExecStart="/home/USERNAMEPLACEHOLDER/frappuccino/inhibitor.sh"
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
5
hots.sh
Normal file
5
hots.sh
Normal file
@ -0,0 +1,5 @@
|
||||
#!/bin/bash
|
||||
while true; do
|
||||
echo "$(date) : I am once again wandering this empty slot..."
|
||||
sleep 2
|
||||
done
|
2
inhibitor.sh
Normal file
2
inhibitor.sh
Normal file
@ -0,0 +1,2 @@
|
||||
#!/bin/bash
|
||||
systemd-inhibit /home/tcsenpai/frappuccino/hots.sh
|
63
install.sh
Normal file
63
install.sh
Normal file
@ -0,0 +1,63 @@
|
||||
#!/bin/bash
|
||||
|
||||
USER=$(whoami)
|
||||
|
||||
if ! [ -d "/home/$USER/frappuccino" ]; then
|
||||
echo "ERROR: You must have frappuccino in:"
|
||||
echo "/home/$USER/frappuccino"
|
||||
exit
|
||||
fi
|
||||
|
||||
echo "Hello, $USER! Let's install Frappuccino and keep your system wide awake!"
|
||||
|
||||
if [ -f /etc/systemd/system/frappuccino.service ]; then
|
||||
echo "You have already a frappuccino.service installed."
|
||||
echo "To force this new installation, execute:"
|
||||
echo "sudo rm -rf /etc/systemd/system/frappuccino.service"
|
||||
exit
|
||||
fi
|
||||
|
||||
PRIVILEGES=$(id -u)
|
||||
|
||||
if [ $PRIVILEGES -eq 0 ]; then
|
||||
echo "You are using root. This is supported but not necessary. We advise you to use your user."
|
||||
echo "Press CTRL+C in 5 seconds to exit..."
|
||||
sleep 7
|
||||
fi
|
||||
|
||||
echo "Everything seems to be nice and packed! Let's a go!"
|
||||
echo "First, we need to check that we have the needed files"
|
||||
|
||||
if ! [ -f "./hots.sh" ]; then
|
||||
echo "Missing hots.sh file. Please redownload."
|
||||
exit
|
||||
fi
|
||||
|
||||
if ! [ -f "./inhibitor.sh" ]; then
|
||||
echo "Missing inhibitor.sh file. Please redownload."
|
||||
exit
|
||||
fi
|
||||
|
||||
if ! [ -f "./frappuccino.service" ]; then
|
||||
echo "Missing frappuccino.service. Please redownload."
|
||||
exit
|
||||
fi
|
||||
|
||||
echo "We do have the files indeed."
|
||||
echo "Setting up the service..."
|
||||
|
||||
echo "Requesting privileges..."
|
||||
sudo echo "Privileges acquired"
|
||||
|
||||
cp ./frappuccino.service ./frappuccino.service.bak
|
||||
sed -i "s/USERNAMEPLACEHOLDER/$(whoami)/g" frappuccino.service
|
||||
sudo mv frappuccino.service /etc/systemd/system/frappuccino.service
|
||||
cp ./frappuccino.service.bak ./frappuccino.service
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl enable frappuccino.service
|
||||
sudo systemctl start frappuccino.service
|
||||
|
||||
echo "If everything is alright, you should see a green 'active' text now."
|
||||
sleep 2
|
||||
sudo systemctl status frappuccino.service
|
||||
|
3
uninstall.sh
Normal file
3
uninstall.sh
Normal file
@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
sudo systemctl disable frappuccino.service
|
||||
sudo rm -rf /etc/systemd/system/frappuccino.service
|
Loading…
x
Reference in New Issue
Block a user