-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/pacman_hook'
Also fixed non-existent path in hook file write.
- Loading branch information
Showing
2 changed files
with
19 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |