summaryrefslogtreecommitdiffstats
path: root/build-aux/edit-script.sh.in
blob: 3e3a1b6a01df243dda37f1b3f5c91001569cc008 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!@BASH@

input=$1
output=$2
mode=$3

"@SED@" \
  -e "s|@rootdir[@]|@ROOTDIR@|g" \
  -e "s|@localedir[@]|@LOCALEDIR@|g" \
  -e "s|@sysconfdir[@]|@sysconfdir@|g" \
  -e "s|@localstatedir[@]|@localstatedir@|g" \
  -e "s|@libmakepkgdir[@]|@LIBMAKEPKGDIR@|g" \
  -e "s|@pkgdatadir[@]|@PKGDATADIR@|g" \
  -e "s|@prefix[@]|@PREFIX@|g" \
  -e "1s|#!/bin/bash|#!@BASH@|g" \
  -e "s|@PACKAGE_VERSION[@]|@PACKAGE_VERSION@|g" \
  -e "s|@PACKAGE_NAME[@]|@PACKAGE_NAME@|g" \
  -e "s|@BUILDSCRIPT[@]|@BUILDSCRIPT@|g" \
  -e "s|@TEMPLATE_DIR[@]|@TEMPLATE_DIR@|g" \
  -e "s|@DEBUGSUFFIX[@]|@DEBUGSUFFIX@|g" \
  -e "s|@INODECMD[@]|@INODECMD@|g" \
  -e "s|@OWNERCMD[@]|@OWNERCMD@|g" \
  -e "s|@MODECMD[@]|@MODECMD@|g" \
  -e "s|@SEDINPLACEFLAGS[@]|@SEDINPLACEFLAGS@|g" \
  -e "s|@SEDPATH[@]|@SEDPATH@|g" \
  -e "s|@DUFLAGS[@]|@DUFLAGS@|g" \
  -e "s|@DUPATH[@]|@DUPATH@|g" \
  -e "s|@configure_input[@]|Generated from ${output##*/}.sh.in; do not edit by hand.|g" \
  "$input" >"$output"

if [[ $mode ]]; then
  chmod "$mode" "$output"
fi