Automatically enable the daemon after installation #65

Closed
opened 2023-01-23 22:01:30 +00:00 by twann · 7 comments

For Arch Linux, this could be done by adding a post_install() function:

PKGBUILD:

 pkgname=tblock
 pkgver=2.6.1
 pkgrel=1
 provides=("$pkgname")
 pkgdesc="An anti-capitalist ad-blocker that uses the hosts file"
 url="https://tblock.codeberg.page"
 arch=("any")
 license=("GPL3")
+install="$pkgname.install"

tblock.install:

pre_install() {
  if systemctl status tblockd &> /dev/null; then
  	systemctl disable --now tblockd
  fi
}


post_install() {
  systemctl enable --now tblockd
}

pre_upgrade() {
  pre_install
}

post_upgrade() {
  post_install
}

pre_remove() {
  pre_install
  # Optionally restore the stock hosts file
  #tblock -Dqn
}

For Arch Linux, this could be done by adding a `post_install()` function: **PKGBUILD:** ``` diff pkgname=tblock pkgver=2.6.1 pkgrel=1 provides=("$pkgname") pkgdesc="An anti-capitalist ad-blocker that uses the hosts file" url="https://tblock.codeberg.page" arch=("any") license=("GPL3") +install="$pkgname.install" ``` **tblock.install:** ```shell pre_install() { if systemctl status tblockd &> /dev/null; then systemctl disable --now tblockd fi } post_install() { systemctl enable --now tblockd } pre_upgrade() { pre_install } post_upgrade() { post_install } pre_remove() { pre_install # Optionally restore the stock hosts file #tblock -Dqn } ```
twann added the
Status: Stale
Kind: Enhancement
Priority: Low
Component: Daemon
labels 2023-01-23 22:01:32 +00:00
twann added this to the 3.0.0 milestone 2023-01-23 22:27:47 +00:00
twann added this to the tblock 3.0.0 project 2023-01-23 22:30:00 +00:00
twann self-assigned this 2023-01-23 23:49:02 +00:00
Poster
Owner

I think that this is probably nice to add for in package for systemd, but I wouldn't add this in packages for other init systems. With OpenRC, for example, on Artix Linux, every time a system service is installed, there is a pacman hook that displays:

:: Running post-transaction hooks...
(1/2) Refreshing PackageKit...
(2/2) Displaying openrc service help ...
        ==> Add a service to runlevel:
        rc-update add <service> <runlevel>
        ==> Start/stop/restart a service:
        rc-service <service> <start/stop/restart>

I've also never seen a package that enables a system service for another init system than systemd and personally, I like being able to choose specifically which services are enabled and which aren't.

I think that this is probably nice to add for in package for systemd, but I wouldn't add this in packages for other init systems. With OpenRC, for example, on Artix Linux, every time a system service is installed, there is a pacman hook that displays: ``` :: Running post-transaction hooks... (1/2) Refreshing PackageKit... (2/2) Displaying openrc service help ... ==> Add a service to runlevel: rc-update add <service> <runlevel> ==> Start/stop/restart a service: rc-service <service> <start/stop/restart> ``` I've also never seen a package that enables a system service for another init system than systemd and personally, I like being able to choose specifically which services are enabled and which aren't.

So if the daemon does not start after installing the GUI, what does it really mean? Will the daemon start after you do the GUI Wizard?

So if the daemon does not start after installing the GUI, what does it really mean? Will the daemon start after you do the GUI Wizard?
Poster
Owner

Well, the only thing the daemon does is to provide automatic updates, which means it is totally optional. Currently, you have to do it manually. See https://docs.tblock.me/2.6.1/post-installation.html#enable-automatic-updates for more information.

Well, the only thing the daemon does is to provide automatic updates, which means it is totally optional. Currently, you have to do it manually. See https://docs.tblock.me/2.6.1/post-installation.html#enable-automatic-updates for more information.

I think would be a good idea to ask users to enable it while doing the Wizard. If that's possible. Because it can be important. Else the lists will never be updated.

I think would be a good idea to ask users to enable it while doing the Wizard. If that's possible. Because it can be important. Else the lists will never be updated.
Poster
Owner

tblock 2.7.0 enables automatic updates by default after installation on Arch-based distributions that use systemd

tblock 2.7.0 enables automatic updates by default after installation on Arch-based distributions that use systemd
twann closed this issue 2023-07-20 12:23:45 +00:00

Oh amazing! So now you simply install TBlock GUI and all good, no need to manually do anything for the updates right?

Oh amazing! So now you simply install TBlock GUI and all good, no need to manually do anything for the updates right?
Poster
Owner

Well, this is included in the tblock package rather than the tblock-gui, but since the later depends on tblock, basically yes.

Well, this is included in the `tblock` package rather than the `tblock-gui`, but since the later depends on `tblock`, basically yes.
Sign in to join this conversation.
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: tblock/tblock#65
There is no content yet.