#!/bin/bash if [ "$(whoami)" != 'root' ]; then echo "Script needs to be run as root" exit 1 fi echo "Creating Python Script..."; cat << 'EOF' > /var/rgb.py #!/bin/python import subprocess import time steps = 20 colors = [[255, 0, 0], [0, 255, 0], [0, 0, 255], [0, 255, 255], [255, 0, 255], [255, 255, 0], [255, 255, 255]] def aTob(a, b): incr = [(b[0] - a[0]) / steps, (b[1] - a[1]) / steps, (b[2] - a[2]) / steps] tmp = [a[0], a[1], a[2]] for i in range(steps): tmp[0] += incr[0] tmp[1] += incr[1] tmp[2] += incr[2] subprocess.run(f"echo \"{int(tmp[0])} {int(tmp[1])} {int(tmp[2])}\" > /sys/class/leds/rgb:kbd_backlight/multi_intensity", shell=True) time.sleep(0.1) while True: c = colors[0] for i in range(1, len(colors)): aTob(c, colors[i]) c = colors[i] aTob(c, colors[0]) EOF chmod +x /var/rgb.py if [ ! $(crontab -l|grep -q "@reboot cd /var && ./rgb.py") ]; then echo "Addind Cron job..."; crontab -l > cronhistory; echo "@reboot cd /var && ./rgb.py" >> cronhistory; crontab cronhistory rm cronhistory fi echo "Finished!"