mirror of
https://github.com/tuxdotrs/tuxOS.git
synced 2025-07-06 17:56:35 +05:30
added packages
This commit is contained in:
37
packages/tuxos-hooks/PKGBUILD
Normal file
37
packages/tuxos-hooks/PKGBUILD
Normal file
@ -0,0 +1,37 @@
|
||||
# Maintainer: tux <0xtux@pm.me>
|
||||
|
||||
pkgname="tuxos-hooks"
|
||||
pkgver=1.0
|
||||
pkgrel=1
|
||||
pkgdesc='tuxOS hooks'
|
||||
arch=('any')
|
||||
license=('GPL3')
|
||||
|
||||
source=(
|
||||
'tuxos-hooks.hook'
|
||||
'tuxos-os-release.hook'
|
||||
'tuxos-lsb-release.hook'
|
||||
'tuxos-reboot-required.hook'
|
||||
'tuxos-hooks-runner'
|
||||
'tuxos-reboot-required'
|
||||
)
|
||||
|
||||
sha512sums=('bb8aa5fb891f8398b48dea93b74ad266d154bdf08f5ab70f5dddf9dd3e560d4c788c4fac5b7d10b9c4310d18d3509c0752e174b69391d0b5fc0c7cc631294ad0'
|
||||
'8e4a325294b92c27e8921d5002216c106a85341de5837cfde8a090e62f695f41ed5b5c562443965e289c99f64511a58a7d205484001433d5ae568146b0664c1c'
|
||||
'7205fdc0a29ac46725a97192075c6485563496dd354683c96a204c3e6492a3a1ec880dbcc3f192ab0b50741b7f67e6c0e90bc884653a87935610b5532e5ba3db'
|
||||
'4e47bbc391573be11dc607bd0e3e3716896092f88e8615f57260e3c5f96feffcb79437dbb0e5283e733931a1017a1348ba9af37ddf4e3a57e6005d381f9594ce'
|
||||
'8559011b9d5e7cae185746fcc2d76735e1ce0c63cfb4a98db0bd819c8a6dce4f5331ad16f8e6c2ddb5a7ab2f8d3947159a1e4de6a099b6a5d7e9f3acf169c8f1'
|
||||
'3bffb02739f75e41fa346c7700e1b8a51a066ef5593ce1bee997a0da5c1d4c46a373b86c069fbdee4b432f4c71a5846369ec5db9d3120297ffafb81fc7f9126b')
|
||||
|
||||
package() {
|
||||
local hooks=${pkgdir}/usr/share/libalpm/hooks
|
||||
local bin=${pkgdir}/usr/bin
|
||||
|
||||
install -Dm644 tuxos-hooks.hook "$hooks"/tuxos-hooks.hook
|
||||
install -Dm644 tuxos-lsb-release.hook "$hooks"/tuxos-lsb-release.hook
|
||||
install -Dm644 tuxos-os-release.hook "$hooks"/tuxos-os-release.hook
|
||||
install -Dm644 tuxos-reboot-required.hook "$hooks"/tuxos-reboot-required.hook
|
||||
|
||||
install -Dm755 tuxos-hooks-runner "$bin"/tuxos-hooks-runner
|
||||
install -Dm755 tuxos-reboot-required "$bin"/tuxos-reboot-required
|
||||
}
|
53
packages/tuxos-hooks/tuxos-hooks-runner
Executable file
53
packages/tuxos-hooks/tuxos-hooks-runner
Executable file
@ -0,0 +1,53 @@
|
||||
#!/bin/bash
|
||||
|
||||
Lsb_release() {
|
||||
local file=/etc/lsb-release
|
||||
|
||||
if [[ -z "`grep "^DISTRIB_RELEASE=" $file`" ]] ; then
|
||||
# add missing DISTRIB_RELEASE=
|
||||
echo "DISTRIB_RELEASE=rolling" >> "$file"
|
||||
fi
|
||||
sed -i "$file" \
|
||||
-e 's|^DISTRIB_ID=.*$|DISTRIB_ID=tuxOS|' \
|
||||
-e 's|^DISTRIB_RELEASE=.*$|DISTRIB_RELEASE=rolling|' \
|
||||
-e 's|^DISTRIB_DESCRIPTION=.*$|DISTRIB_DESCRIPTION=\"tuxOS\"|'
|
||||
}
|
||||
|
||||
Os_release() {
|
||||
local file=/usr/lib/os-release
|
||||
|
||||
sed -i "$file" \
|
||||
-e 's|^NAME=.*$|NAME=\"tuxOS\"|' \
|
||||
-e 's|^PRETTY_NAME=.*$|PRETTY_NAME=\"tuxOS\"|' \
|
||||
-e 's|^ID=.*$|ID=tuxOS|' \
|
||||
-e 's|^ID_LIKE=.*$|ID_LIKE=arch|' \
|
||||
-e 's|^BUILD_ID=.*$|BUILD_ID=rolling|' \
|
||||
-e 's|^HOME_URL=.*$|HOME_URL=\"https://github.com/0xtux/tuxOS\"|' \
|
||||
-e 's|^DOCUMENTATION_URL=.*$|DOCUMENTATION_URL=\"https://github.com/0xtux/tuxOS/wiki\"|' \
|
||||
-e 's|^SUPPORT_URL=.*$|SUPPORT_URL=\"https://github.com/0xtux/tuxOS\"|' \
|
||||
-e 's|^BUG_REPORT_URL=.*$|BUG_REPORT_URL=\"https://github.com/0xtux/tuxOS/issues\"|' \
|
||||
-e 's|^LOGO=.*$|LOGO=tuxOS|'
|
||||
|
||||
if [ -z "$(grep "^ID_LIKE=" $file)" ] && [ -n "$(grep "^ID=" $file)" ] ; then
|
||||
# add missing ID_LIKE=
|
||||
sed -i $file -e '/^ID=/a \ID_LIKE=arch'
|
||||
fi
|
||||
|
||||
# fix issue file
|
||||
sed -i 's|Arch Linux|tuxOS|g' /etc/issue /usr/share/factory/etc/issue
|
||||
}
|
||||
|
||||
Main()
|
||||
{
|
||||
local hookname="$1"
|
||||
|
||||
case "$hookname" in
|
||||
os-release) Os_release ;;
|
||||
lsb-release) Lsb_release ;;
|
||||
"") Os_release
|
||||
Lsb_release
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
Main "$@"
|
10
packages/tuxos-hooks/tuxos-hooks.hook
Normal file
10
packages/tuxos-hooks/tuxos-hooks.hook
Normal file
@ -0,0 +1,10 @@
|
||||
[Trigger]
|
||||
Operation = Install
|
||||
Operation = Upgrade
|
||||
Type = Package
|
||||
Target = tuxos-hooks
|
||||
|
||||
[Action]
|
||||
Description = Update tuxOS specific hooks.
|
||||
When = PostTransaction
|
||||
Exec = /usr/bin/tuxos-hooks-runner
|
10
packages/tuxos-hooks/tuxos-lsb-release.hook
Normal file
10
packages/tuxos-hooks/tuxos-lsb-release.hook
Normal file
@ -0,0 +1,10 @@
|
||||
[Trigger]
|
||||
Operation = Install
|
||||
Operation = Upgrade
|
||||
Type = Package
|
||||
Target = lsb-release
|
||||
|
||||
[Action]
|
||||
Description = Add tuxOS specific config.
|
||||
When = PostTransaction
|
||||
Exec = /usr/bin/tuxos-hooks-runner lsb-release
|
10
packages/tuxos-hooks/tuxos-os-release.hook
Normal file
10
packages/tuxos-hooks/tuxos-os-release.hook
Normal file
@ -0,0 +1,10 @@
|
||||
[Trigger]
|
||||
Operation = Install
|
||||
Operation = Upgrade
|
||||
Type = Package
|
||||
Target = filesystem
|
||||
|
||||
[Action]
|
||||
Description = Add tuxOS specific config.
|
||||
When = PostTransaction
|
||||
Exec = /usr/bin/tuxos-hooks-runner os-release
|
89
packages/tuxos-hooks/tuxos-reboot-required
Executable file
89
packages/tuxos-hooks/tuxos-reboot-required
Executable file
@ -0,0 +1,89 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Avoid unnecessary reboots: don't notify if an updated package is
|
||||
# - not currently running (e.g. alternative kernel)
|
||||
# - not in use (e.g. alternative driver)
|
||||
|
||||
IsRunningKernel() {
|
||||
cat /proc/cmdline | sed 's|.*/vmlinuz-\(linux[a-z0-9-]*\) .*|\1|'
|
||||
}
|
||||
|
||||
DoNotify() {
|
||||
local xx
|
||||
|
||||
for xx in "$DESKTOP_SESSION" "$XDG_CURRENT_DESKTOP" ; do
|
||||
if [[ -n "$xx" ]] ; then
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ -n "$xx" ]] ; then
|
||||
local user userid cmd
|
||||
|
||||
for user in $(/usr/bin/users) ; do
|
||||
userid=$(/usr/bin/id -u $user)
|
||||
cmd=(DISPLAY=:0 DBUS_SESSION_ADDRESS=unix:path=/run/user/$userid/bus /usr/bin/notify-send)
|
||||
cmd+=(--icon=system-reboot --urgency=critical)
|
||||
cmd+=("\"tuxOS\`s core system package upgraded, You need to reboot the machine.\"")
|
||||
/usr/bin/su $user -c "${cmd[*]}"
|
||||
done
|
||||
else
|
||||
# at TTY
|
||||
echo -e "[*] tuxOS\`s core system package upgraded, You need to reboot the machine.">&2
|
||||
fi
|
||||
}
|
||||
|
||||
Main() {
|
||||
local targets=$(cat) # list of updated package names from the hook (stdin)
|
||||
local target
|
||||
local running_kernel=""
|
||||
|
||||
# do not notify if the updated package is not in use
|
||||
for target in $targets ; do
|
||||
case "$target" in
|
||||
linux | linux-lts | linux-zen | linux-hardened | linux-rt | linux-rt-lts | linux-lts?? | linux-lts???)
|
||||
# Note: only official and older LTS kernels are checked.
|
||||
if IsRunningKernel "$target" ; then
|
||||
DoNotify
|
||||
fi
|
||||
;;
|
||||
nvidia)
|
||||
if IsRunningKernel linux ; then
|
||||
DoNotify
|
||||
fi
|
||||
;;
|
||||
nvidia-lts)
|
||||
if IsRunningKernel linux-lts ; then
|
||||
DoNotify
|
||||
fi
|
||||
;;
|
||||
amd-ucode)
|
||||
if [ "$(device-info --cpu)" = "AuthenticAMD" ] ; then
|
||||
DoNotify
|
||||
fi
|
||||
;;
|
||||
intel-ucode)
|
||||
if [ "$(device-info --cpu)" = "GenuineIntel" ] ; then
|
||||
DoNotify
|
||||
fi
|
||||
;;
|
||||
btrfs-progs)
|
||||
# Notify only if btrfs is in use
|
||||
if [ -n "$(/usr/bin/df -hT | awk '{print $2}' | grep -w btrfs)" ] ; then
|
||||
DoNotify
|
||||
fi
|
||||
;;
|
||||
wayland | egl-wayland)
|
||||
case "$XDG_SESSION_TYPE" in
|
||||
x11) ;;
|
||||
*) DoNotify ;;
|
||||
esac
|
||||
;;
|
||||
*)
|
||||
DoNotify
|
||||
;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
Main "$@"
|
37
packages/tuxos-hooks/tuxos-reboot-required.hook
Normal file
37
packages/tuxos-hooks/tuxos-reboot-required.hook
Normal file
@ -0,0 +1,37 @@
|
||||
[Trigger]
|
||||
Operation = Upgrade
|
||||
Type = Package
|
||||
Target = amd-ucode
|
||||
Target = intel-ucode
|
||||
Target = btrfs-progs
|
||||
Target = cryptsetup
|
||||
Target = linux
|
||||
Target = linux-hardened
|
||||
Target = linux-lts
|
||||
Target = linux-zen
|
||||
Target = linux-rt
|
||||
Target = linux-rt-lts
|
||||
Target = linux-firmware*
|
||||
Target = nvidia
|
||||
Target = nvidia-dkms
|
||||
Target = nvidia-*xx-dkms
|
||||
Target = nvidia-*xx
|
||||
Target = nvidia-*lts-dkms
|
||||
Target = nvidia*-lts
|
||||
Target = mesa
|
||||
Target = systemd*
|
||||
Target = wayland
|
||||
Target = virtualbox-guest-utils
|
||||
Target = virtualbox-host-dkms
|
||||
Target = virtualbox-host-modules-arch
|
||||
Target = egl-wayland
|
||||
Target = xf86-video-*
|
||||
Target = xorg-server*
|
||||
Target = xorg-fonts*
|
||||
|
||||
[Action]
|
||||
Description = Check if user should be informed about rebooting after certain system package upgrades.
|
||||
When = PostTransaction
|
||||
Depends = libnotify
|
||||
NeedsTargets
|
||||
Exec = /usr/bin/tuxos-reboot-required
|
Reference in New Issue
Block a user