Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/pacman_hook'
Browse files Browse the repository at this point in the history
Also fixed non-existent path in hook file write.
  • Loading branch information
GPMueller committed Jun 16, 2017
2 parents 9265f68 + d9f6158 commit 00faa6c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
2 changes: 2 additions & 0 deletions install.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
from pyscripts import s11_shell as shell
from pyscripts import s12_aur as aur
from pyscripts import s13_users as users
from pyscripts import s14_pacman_reflector_hook as pacman_reflector_hook

import pyscripts.utilities as install_utilities

Expand Down Expand Up @@ -64,3 +65,4 @@
shell.configure_shell()
aur.configure_aur()
users.configure_users(ui)
pacman_reflector_hook.configure_pacman_reflector_hook()
17 changes: 17 additions & 0 deletions pyscripts/s14_pacman_reflector_hook.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
pacman_reflector_hook = """[Trigger]
Operation = Upgrade
Type = Package
Target = pacman-mirrorlist
[Action]
Description = Updating pacman-mirrorlist with reflector and removing pacnew...
When = PostTransaction
Depends = reflector
Exec = /usr/bin/env sh -c "reflector --latest 100 --sort rate --protocol https --save /etc/pacman.d/mirrorlist; if [[ -f /etc/pacman.d/mirrorlist.pacnew ]]; then rm /etc/pacman.d/mirrorlist.pacnew; fi"
"""

def configure_pacman_reflector_hook():
import os
os.makedirs('/mnt/etc/pacman.d/hooks')
with open('/mnt/etc/pacman.d/hooks/mirrorupgrade.hook', 'w+') as txt_file:
txt_file.write(pacman_reflector_hook)

0 comments on commit 00faa6c

Please # to comment.