71 lines
1.4 KiB
Bash
Executable File
71 lines
1.4 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
if [[ "$UID" != 0 ]]; then
|
|
echo "USER NOT ROOT"
|
|
sudo "$0"
|
|
exit
|
|
else
|
|
echo "USER IS ROOT"
|
|
fi
|
|
|
|
ping -c 1 1.1.1.1 > /dev/null
|
|
have_internet="$?"
|
|
|
|
# sleep 1
|
|
|
|
cd "/root"
|
|
|
|
mkdir -p /root/.gnupg 2>/dev/null
|
|
chmod 700 /root/.gnupg
|
|
|
|
haveged -w 1024
|
|
pacman-key --init
|
|
pkill haveged
|
|
|
|
pacman-key --populate archlinux melawy-linux endeavouros arcolinux chaotic cachyos
|
|
|
|
pacman-key --lsign-key melawy-linux
|
|
pacman-key --lsign-key cachyos
|
|
pacman-key --lsign-key arcolinux
|
|
pacman-key --lsign-key chaotic
|
|
pacman-key --lsign-key endeavouros
|
|
|
|
if [ "$have_internet" -eq 0 ]; then
|
|
pacman-key --recv-keys valeria@fadeeva.me --keyserver hkps://keys.openpgp.org
|
|
pacman-key --lsign-key valeria@fadeeva.me
|
|
fi
|
|
|
|
pacman-key --updatedb
|
|
|
|
if [ "$have_internet" -eq 0 ]; then
|
|
pacman -Syy
|
|
fi
|
|
|
|
title="Successed!"
|
|
msg="$(date '+%Y.%m.%d %H:%M:%S')"
|
|
|
|
users=$(/usr/bin/users | sed 's| |\n|g' | sort | uniq)
|
|
for user in $users
|
|
do
|
|
userid=$(/usr/bin/id -u "$user")
|
|
|
|
cmd=(
|
|
DISPLAY=:0
|
|
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/"$userid"/bus
|
|
/usr/bin/notify-send
|
|
--icon=face-smile
|
|
--urgency=low
|
|
-t 5000
|
|
-a "'Keys sign'"
|
|
"'$title'"
|
|
"'$msg'"
|
|
)
|
|
|
|
/usr/bin/su "$user" -c "${cmd[*]}"
|
|
|
|
if [ "$user" != "liveuser" ]; then
|
|
rm /home/"$user"/.config/autostart/key-sign.sh.desktop
|
|
rm /home/"$user"/.local/bin/key-sign.sh
|
|
fi
|
|
done
|