1.\" $OpenBSD: pkg_subst.1,v 1.1 2018/06/26 05:38:49 espie Exp $ 2.\" 3.\" Copyright (c) 2010 Marc Espie <espie@openbsd.org> 4.\" 5.\" Permission to use, copy, modify, and distribute this software for any 6.\" purpose with or without fee is hereby granted, provided that the above 7.\" copyright notice and this permission notice appear in all copies. 8.\" 9.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16.\" 17.Dd $Mdocdate: June 26 2018 $ 18.Dt PKG_SUBST 1 19.Os 20.Sh NAME 21.Nm pkg_subst 22.Nd substitute variables' values in files 23.Sh SYNOPSIS 24.Nm pkg_subst 25.Op Fl ci 26.Op Fl B Ar basedir 27.Op Fl D Ar name Ns Op = Ns Ar value 28.Op Fl g Ar group 29.Op Fl m Ar mode 30.Op Fl o Ar owner 31.Op Ar file ... 32.Sh DESCRIPTION 33.Nm 34is used within the ports tree to substitute variable values, using 35the exact same conventions used by 36.Xr pkg_create 1 . 37Constructs like 38.Li ${VAR} 39will be replaced with the variable value, according to 40.Fl D Ar name Ns Op = Ns Ar value 41options. 42.Pp 43The options are as follows 44.Bl -tag -width Dname[=value]xxx 45.It Fl B Ar basedir 46Specify a basedir in which we know file properties. 47It is forbidden to copy files from elsewhere without 48.Fl m Ar mode . 49.It Fl c 50Copy and substitute. 51Number of 52.Ar file 53arguments must be even. 54They are paired as 55.Ar src1 56.Ar dest1 , 57.Ar src2 58.Ar dest2 ... 59and each 60.Ar src 61file is substituted and copied into the corresponding 62.Ar dest 63file. 64.It Xo 65.Fl D 66.Ar name Ns Op = Ns Ar value 67.Xc 68Define 69.Ar name 70to 71.Ar value , 72or to 1 if no value is given. 73.It Fl g Ar group 74Change group of destination file to 75.Ar group . 76.It Fl i 77Ignore changes to group or owner that failed. 78.It Fl m Ar mode 79Change mode of destination file to 80.Ar mode . 81.It Fl o Ar owner 82Change owner of destination file to 83.Ar owner . 84.El 85.Pp 86If no 87.Ar file 88arguments is given, 89.Nm 90acts as a filter from stdin to stdout. 91.Pp 92Without 93.Fl c , 94each 95.Ar file 96is backed up as 97.Ar file.beforesubst 98before the substitution occurs. 99.Sh SEE ALSO 100.Xr install 1 , 101.Xr pkg_create 1 102