summaryrefslogtreecommitdiff
path: root/create-hook
diff options
context:
space:
mode:
Diffstat (limited to 'create-hook')
-rwxr-xr-xcreate-hook17
1 files changed, 17 insertions, 0 deletions
diff --git a/create-hook b/create-hook
new file mode 100755
index 0000000..70adc95
--- /dev/null
+++ b/create-hook
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+input='/usr/share/libalpm/hooks/90-linux.hook'
+target=$(
+ grep -m1 'Target = ' "${input}" | \
+ cut -d'=' -f2 | \
+ sed 's|\s\+||g'
+)
+sed '
+ /Description =/{
+ s/=\s*/= Test permissions for /
+ a When = PreTransaction\
+Exec = /usr/bin/bash -c '"'"'[ -w /'"${target}"' ]'"'"'\
+AbortOnFail
+ q
+ }
+' "${input}"