Author Topic: [hooks] stop update pack - test pre-install  (Read 593 times)

0 Members and 1 Guest are viewing this topic.

Offline papajoke

  • Vollwertiges Mitglied
  • ***
  • Posts: 135
  • from www.manjaro.fr
  • Branch: stable/testing
  • Desktop: KDE4 and 5 - zsh
  • GPU driver: video-nouveau free
  • Kernel: x64
  • Skill: Intermediate
[hooks] stop update pack - test pre-install
« on: 23. February 2016, 06:15:14 »
With the problem in update pack 9 and luks-encryption, I just have an idea :

block pre-install the update if test is false

insert the hook in Manjaro-system or make a new package "manjaro-hooks" in pacman.conf.SyncFirst =

the hook by default is:
/usr/share/libalpm/hooks/manjaro-system.hook
Code: [Select]
[Trigger]
Operation = Upgrade
Type = Package
Target = NONE
[Action]
Description = validate install
When = PreTransaction
Exec = /usr/bin/true
AbortOnFail
(no action)


When there is a big problem as luks-encryption, inc package version and change as this exemple:
/usr/share/libalpm/hooks/manjaro-system.hook
Code: [Select]
[Trigger]
Operation = Upgrade
Operation = Install
Type = Package
Target = linux41
Target = linux318
Target = luks-cryptag
[Action]
Description = validate install
When = PreTransaction
Exec = /usr/share/libalpm/hooks.bin/manjaro-system.sh
NeedsTargets
AbortOnFail

/usr/share/libalpm/hooks.bin/manjaro-system.sh
Code: [Select]
#!/usr/bin/bash
while read -r package; do
   case "$package" in
      linux41|linux318)
         if [[ $(pacman -Qq "luks-cryptag" 2>/dev/null) == "luks-cryptag" ]]; then
            # and test versions !
            echo "... kernel not compatible ... wait somes days ... go to forum http..."
            exit 1   # die pacman
         fi
      ;;
      luks-cryptag)
          echo '"attention ... go forum for info ..."
      ;;
   esac
done
exit 0

with "AbortOnFail", pacman stop action pre-install if script in "Exec" return false


################################################################
################################################################


Another near idea

use hook to help with files conflict
1) identify conflicts with the update in testing
2) use the hook in stable to give the solution found in testing forum

Code: [Select]
[Trigger]
Operation = Upgrade
Type = Package
Target = oxygen-icons
[Action]
Description = validate install
When = PreTransaction
Exec = /usr/share/libalpm/hooks.bin/manjaro-conflicting.sh
NeedsTargets
AbortOnFail
/usr/share/libalpm/hooks.bin/manjaro-conflicting.sh
Code: [Select]
#!/usr/bin/bash
while read -r package; do
   case "$package" in
      oxygen-icons)
         if [[ $(pacman -Qo '/usr/share/icons/oxygen/128x128/mimetypes/fonts-package.png') == " kdebase-workspace" ]]; then
            echo "remove kdebase-workspace and after ..."
            exit 1
         fi
      ;;
done
exemple found in this update pack 9

« Last Edit: 23. February 2016, 10:37:16 by papajoke »

Offline ringo

  • Held Mitglied
  • *****
  • Posts: 9684
  • www.manjaro-nl.org
    • Manjaro Belgium + forum
  • Branch: unsourced
  • Desktop: xfce
  • GPU Card: Nvidia Geforce 8600 GT (acer 23inch)
  • GPU driver: Free*
  • Kernel: linux kernel
  • Skill: Novice
Re: [hooks] stop update pack - test pre-install
« Reply #1 on: 23. February 2016, 08:43:06 »
matter is, noone is testing in unstable or in testing..mayby it is good to setup a vbox install for that :)
Dutch go the dutch site :)

Offline papajoke

  • Vollwertiges Mitglied
  • ***
  • Posts: 135
  • from www.manjaro.fr
  • Branch: stable/testing
  • Desktop: KDE4 and 5 - zsh
  • GPU driver: video-nouveau free
  • Kernel: x64
  • Skill: Intermediate
Re: [hooks] stop update pack - test pre-install
« Reply #2 on: 23. February 2016, 09:10:24 »
my test is ok  (not same test in script)

in /etc/pacman.conf
Code: [Select]
SyncFirst    = manjaro-system manjaro-hooks
...
[patrick]
SigLevel = Never
Server= file:///home/patrick/manjaro-hooks/pkgbuild/

1) pacman -Syu
2) pacman -S manjaro-hooks
3) change code source  in script , inc version in PKGBUILD et update local repo
4) downgrade a package
5) pacman -Syu
the new version run well before update the packages ; and new hook test packages before update

my PKGBUILD
Code: [Select]
# Maintainer: Papajoker
pkgname=manjaro-hooks
pkgver=1
pkgrel=5
pkgdesc="test hook"
arch=('any')
license=('GPL')
depends=('pacman')
source=("usr.tar.gz")
md5sums=('SKIP')

package() {
  cp -r usr ${pkgdir}/
}
note: for disable hook just remove extention ".hook"


« Last Edit: 23. February 2016, 14:28:11 by papajoke »