mirror of
https://git.FreeBSD.org/ports.git
synced 2024-11-23 00:43:28 +00:00
22f328d041
PR: ports/192124 Submitted by: John Hein With hat: portmgr
112 lines
3.9 KiB
Awk
112 lines
3.9 KiB
Awk
# $FreeBSD$
|
|
#
|
|
# MAINTAINER: portmgr@FreeBSD.org
|
|
#
|
|
# This file handles converting keywords to pkg_install compatible format.
|
|
# It will be removed once pkg_install is EOL.
|
|
#
|
|
|
|
# @sample somefile.conf.sample
|
|
# ->
|
|
# @comment begin @sample somefile.conf.sample
|
|
# @unexec if cmp -s %D/etc/somefile.conf %D/etc/somefile.conf.sample; then rm -f %D/etc/somefile.conf; fi
|
|
# etc/somefile.conf.sample
|
|
# @exec if ! [ -f %D/etc/somefile.conf ]; then cp %D/etc/somefile.conf.sample %D/etc/somefile.conf; fi
|
|
# @comment end @sample somefile.conf.sample
|
|
#
|
|
##
|
|
# @shell bin/shell
|
|
# ->
|
|
# @comment begin @shell bin/shell
|
|
# @exec cp /etc/shells /etc/shells.bak; (grep -v %D/%F /etc/shells.bak; echo %D/%F) >/etc/shells; rm -f /etc/shells.bak
|
|
# @unexec cp /etc/shells /etc/shells.bak; (grep -v %D/%F /etc/shells.bak) >/etc/shells; rm -f /etc/shells.bak
|
|
# @comment end @shell bin/shell
|
|
|
|
$1 == "@sample" {
|
|
sample_file=$2
|
|
# Take out .sample
|
|
target_file=substr(sample_file, 0, length(sample_file) - 7)
|
|
print "@comment begin " $0
|
|
print "@unexec if cmp -s '%D/" target_file "' '%D/" sample_file "'; then rm -f '%D/" target_file "'; fi"
|
|
print sample_file
|
|
print "@exec if ! [ -f '%D/" target_file "' ]; then /bin/cp -p '%D/" sample_file "' '%D/" target_file "'; fi"
|
|
print "@comment end " $0
|
|
next
|
|
}
|
|
|
|
$1 == "@shell" {
|
|
shell_file=$2
|
|
print "@comment begin " $0
|
|
print shell_file
|
|
print "@exec cp /etc/shells /etc/shells.bak; (grep -v %D/%F /etc/shells.bak; echo %D/%F) >/etc/shells; rm -f /etc/shells.bak"
|
|
print "@unexec cp /etc/shells /etc/shells.bak; (grep -v %D/%F /etc/shells.bak) >/etc/shells; rm -f /etc/shells.bak"
|
|
print "@comment end " $0
|
|
next
|
|
}
|
|
|
|
$1 == "@fc" {
|
|
font_dir=$2
|
|
print "@comment begin " $0
|
|
print "@exec fc-cache -s %D/" font_dir " 2>/dev/null || true"
|
|
print "@unexec fc-cache -s %D/" font_dir " 2>/dev/null || true"
|
|
print "@unexec rmdir %D/"font_dir" 2>/dev/null || true"
|
|
print "@comment end " $0
|
|
next
|
|
}
|
|
|
|
$1 == "@fcfontsdir" {
|
|
font_dir=$2
|
|
print "@comment begin " $0
|
|
print "@exec fc-cache -s %D/" font_dir " 2>/dev/null || true"
|
|
print "@exec mkfontscale %D/" font_dir " 2>/dev/null || true"
|
|
print "@exec mkfontdir %D/" font_dir " 2>/dev/null || true"
|
|
print "@unexec fc-cache -s %D/" font_dir " 2>/dev/null || true"
|
|
print "@unexec mkfontscale %D/" font_dir " 2>/dev/null || true"
|
|
print "@unexec if [ -e %D/%@/fonts.scale -a \"`stat -f '%%z' %D/" font_dir "/fonts.scale 2>/dev/null`\" = '2' ]; then rm %D/" font_dir "/fonts.scale ; fi"
|
|
print "@unexec mkfontdir %D/" font_dir " 2>/dev/null || true"
|
|
print "@unexec if [ -e %D/" font_dir "/fonts.dir -a \"`stat -f '%%z' %D/" font_dir "/fonts.dir 2>/dev/null`\" = '2' ]; then rm %D/" font_dir "/fonts.dir ; fi"
|
|
print "@unexec rmdir %D/"font_dir" 2>/dev/null || true"
|
|
print "@comment end " $0
|
|
next
|
|
}
|
|
|
|
$1 == "@fontsdir" {
|
|
font_dir=$2
|
|
print "@comment begin " $0
|
|
print "@exec mkfontscale %D/" font_dir " 2>/dev/null || true"
|
|
print "@exec mkfontdir %D/" font_dir " 2>/dev/null || true"
|
|
print "@unexec mkfontscale %D/" font_dir " 2>/dev/null || true"
|
|
print "@unexec if [ -e %D/%@/fonts.scale -a \"`stat -f '%%z' %D/" font_dir "/fonts.scale 2>/dev/null`\" = '2' ]; then rm %D/" font_dir "/fonts.scale ; fi"
|
|
print "@unexec mkfontdir %D/" font_dir " 2>/dev/null || true"
|
|
print "@unexec if [ -e %D/" font_dir "/fonts.dir -a \"`stat -f '%%z' %D/" font_dir "/fonts.dir 2>/dev/null`\" = '2' ]; then rm %D/" font_dir "/fonts.dir ; fi"
|
|
print "@unexec rmdir %D/"font_dir" 2>/dev/null || true"
|
|
print "@comment end " $0
|
|
next
|
|
}
|
|
|
|
$1 == "@dirrmtry" {
|
|
directory=substr($0, 11, length($0) - 10)
|
|
print "@comment begin " $0
|
|
if ($2 ~ /^\//) {
|
|
print "@unexec rmdir \"" directory "\" 2>/dev/null || true"
|
|
} else {
|
|
print "@unexec rmdir \"%D/" directory "\" 2>/dev/null || true"
|
|
}
|
|
print "@comment end " $0
|
|
next
|
|
}
|
|
|
|
$1 == "@fmtutil" {
|
|
print "@comment begin " $0
|
|
print "@exec fmtutil-sys --missing >/dev/null"
|
|
for (i = 2; i <= NF; i++)
|
|
print "@unexec rm -f "$i"; rmdir -p `dirname "$1"` 2>/dev/null"
|
|
print "@comment end " $0
|
|
next
|
|
}
|
|
|
|
# Print everything else as-is
|
|
{
|
|
print $0
|
|
}
|