Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # lightbulb-changer.sh
- # Maintainer: ArchBTW
- # Dependencies: systemd, vim, yay, lightbulb-git
- # Najprej posodobimo sistem, ker zakaj pa ne
- echo ":: Syncing repositories..."
- sudo pacman -Syu --noconfirm
- # Preverimo če je AUR helper nameščen
- if ! command -v yay &> /dev/null; then
- echo ":: Installing yay from AUR..."
- git clone https://aur.archlinux.org/yay.git
- cd yay
- makepkg -si
- fi
- # Namestimo potrebne pakete iz AUR
- yay -S lightbulb-git lightbulb-utils-git lightbulb-contrib-git --noconfirm
- # Preverimo če je systemd service zagnan
- sudo systemctl status lightbulb.service || {
- echo ":: Creating systemd service..."
- cat > /etc/systemd/system/lightbulb.service << EOF
- [Unit]
- Description=Advanced Light Bulb Management Daemon
- After=network.target
- [Service]
- Type=simple
- ExecStart=/usr/bin/lightbulbd
- Restart=always
- [Install]
- WantedBy=multi-user.target
- EOF
- sudo systemctl daemon-reload
- sudo systemctl enable --now lightbulb.service
- }
- # Preverimo če je config file pravilno nastavljen
- if [ ! -f ~/.config/lightbulb/config ]; then
- echo ":: Creating config file..."
- mkdir -p ~/.config/lightbulb
- cat > ~/.config/lightbulb/config << EOF
- # lightbulb config
- use_wayland=true
- compositor=sway
- power_save=false
- rgb=true
- init_brightness=420
- EOF
- fi
- # Zamenjamo žarnico
- echo ":: Changing light bulb..."
- lightbulb-ctl replace --force || {
- echo ":: Error: Manual intervention required"
- vim ~/.config/lightbulb/config
- }
- # Preverimo loge
- journalctl -u lightbulb.service -f &
- # Dodamo v wiki
- echo ":: Don't forget to update the Arch Wiki..."
- firefox https://wiki.archlinux.org/title/Light_Bulb_Management
- # Obvezno pohvalimo se na forumu
- echo ":: BTW I use Arch..."
Advertisement
Add Comment
Please, Sign In to add comment