1 # Buildsheet autogenerated by ravenadm tool -- Do not edit.
3 NAMEBASE= autoselect-ssl
7 SDESC[standard]= Dynamic links to SSL program variants
12 SPKGS[standard]= single
14 OPTIONS_AVAILABLE= none
15 OPTIONS_STANDARD= none
18 LICENSE_FILE= ISCL:{{FILESDIR}}/LICENSE_ISC
23 ${CP} ${FILESDIR}/Makefile ${WRKSRC}/
24 ${CP} ${FILESDIR}/autoselect.c.in ${WRKSRC}/
26 [FILE:761:descriptions/desc.single]
27 This package provides:
33 There can be up to 4 variants of SSL installed on a system:
34 openssl, libressl, openssl-devel, and libressl-devel
36 These selector programs will exec one of variants based on the ravenadm's
37 set SSL default and the SSL_VARIANT environment variable.
39 The environment variable has the highest priority. If SSL_VARIANT is
40 set, the search will be limited to /raven/bin/ssl_${SSL_VARIANT}/${ARG0}.
41 If that doesn't exist, an appropriate error will be produced instead.
43 Without the environment directive, the SSL default of the ravenadm profile
44 is checked first, and then this order: openssl, libressl, openssl-devel,
45 libressl-devel. The program will exec the first variant that it finds.
48 [FILE:39:manifests/plist.single]
56 [FILE:742:files/LICENSE_ISC]
57 Copyright (c) 2019, The Ravenports Project.
59 Permission to use, copy, modify, and/or distribute this software for any
60 purpose with or without fee is hereby granted, provided that the above
61 copyright notice and this permission notice appear in all copies.
63 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
64 WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
65 MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
66 ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
67 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
68 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
69 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
72 [FILE:350:files/Makefile]
75 autoselect.c: autoselect.c.in
76 sed -e "s|%%SSL_VARIANT%%|${SSL_VARIANT}|" \
77 -e "s|%%PREFIX%%|${PREFIX}|g" ${.ALLSRC} > ${.TARGET}
80 ${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.ALLSRC}
83 .for prog in openssl c_rehash nc ocspcheck
84 ${BSD_INSTALL_PROGRAM} generic ${DESTDIR}${PREFIX}/bin/${prog}
88 [FILE:2691:files/autoselect.c.in]
90 * This program runs one of the four SSL variants supported by ravenports.
91 * The first priority is the variant specified by SSL_VARIANT environment
92 * variable. The second priority is the SSL default defined by the
93 * ravenadm profile that builds this file. The remaining priority is:
99 * If no SSL variant is installed, an error message will be displayed,
100 * otherwise the requested program will be executed.
109 main(int argc, char **argv)
113 char *ALPHA = "openssl";
114 char *BRAVO = "libressl";
115 char *CHARLIE = "openssl-devel";
116 char *DELTA = "libressl-devel";
117 char *ZULU = "%%SSL_VARIANT%%";
120 char recommand[1024];
123 * Get the last path element of the program name being executed
125 cmd = strrchr(argv[0], '/');
131 override = getenv("SSL_VARIANT");
132 if (override != NULL) {
133 if (strcmp (override, ALPHA) == 0) {
135 } else if (strcmp (override, BRAVO) == 0) {
137 } else if (strcmp (override, CHARLIE) == 0) {
139 } else if (strcmp (override, DELTA) == 0) {
142 printf ("Invalid SSL_VARIANT value: %s\n",
146 snprintf(recommand, 1024, "%%PREFIX%%/%s/bin/%s",
150 if (sslver == NULL) {
151 snprintf(recommand, 1024, "%%PREFIX%%/%s/bin/%s",
153 if (access(recommand, F_OK) != -1) { sslver = ZULU; };
155 if (sslver == NULL && ZULU != ALPHA) {
156 snprintf(recommand, 1024, "%%PREFIX%%/%s/bin/%s",
158 if (access(recommand, F_OK) != -1) { sslver = ALPHA; };
160 if (sslver == NULL && ZULU != BRAVO) {
161 snprintf(recommand, 1024, "%%PREFIX%%/%s/bin/%s",
163 if (access(recommand, F_OK) != -1) { sslver = BRAVO; };
165 if (sslver == NULL && ZULU != CHARLIE) {
166 snprintf(recommand, 1024, "%%PREFIX%%/%s/bin/%s",
168 if (access(recommand, F_OK) != -1) { sslver = CHARLIE; };
170 if (sslver == NULL && ZULU != DELTA) {
171 snprintf(recommand, 1024, "%%PREFIX%%/%s/bin/%s",
173 if (access(recommand, F_OK) != -1) { sslver = DELTA; };
175 if (sslver == NULL) {
176 printf ("No version of %s is installed.\n", cmd);
181 execv(recommand, argv);
184 * Execution failed, so write out an error message
186 printf ("Command execution failed: %s\n", recommand);
187 printf (" arguments:");
188 for (x = 1; x < argc; x++)
189 printf (" %s", argv[x]);