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:779:descriptions/desc.single]
27 This package provides:
33 There can be up to 5 variants of SSL installed on a system:
34 openssl10, openssl11, openssl30, libressl, 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: openssl30, libressl, openssl11,
45 libressl-devel, openssl10. The program will exec the first variant that
49 [FILE:39:manifests/plist.single]
57 [FILE:742:files/LICENSE_ISC]
58 Copyright (c) 2019, The Ravenports Project.
60 Permission to use, copy, modify, and/or distribute this software for any
61 purpose with or without fee is hereby granted, provided that the above
62 copyright notice and this permission notice appear in all copies.
64 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
65 WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
66 MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
67 ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
68 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
69 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
70 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
73 [FILE:350:files/Makefile]
76 autoselect.c: autoselect.c.in
77 sed -e "s|%%SSL_VARIANT%%|${SSL_VARIANT}|" \
78 -e "s|%%PREFIX%%|${PREFIX}|g" ${.ALLSRC} > ${.TARGET}
81 ${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.ALLSRC}
84 .for prog in openssl c_rehash nc ocspcheck
85 ${BSD_INSTALL_PROGRAM} generic ${DESTDIR}${PREFIX}/bin/${prog}
89 [FILE:2961:files/autoselect.c.in]
91 * This program runs one of the five SSL variants supported by ravenports.
92 * The first priority is the variant specified by SSL_VARIANT environment
93 * variable. The second priority is the SSL default defined by the
94 * ravenadm profile that builds this file. The remaining priority is:
101 * If no SSL variant is installed, an error message will be displayed,
102 * otherwise the requested program will be executed.
111 main(int argc, char **argv)
115 char *ALPHA = "openssl30";
116 char *BRAVO = "libressl";
117 char *CHARLIE = "openssl11";
118 char *DELTA = "libressl-devel";
119 char *ECHO = "openssl10";
120 char *ZULU = "%%SSL_VARIANT%%";
123 char recommand[1024];
126 * Get the last path element of the program name being executed
128 cmd = strrchr(argv[0], '/');
134 override = getenv("SSL_VARIANT");
135 if (override != NULL) {
136 if (strcmp (override, ALPHA) == 0) {
138 } else if (strcmp (override, BRAVO) == 0) {
140 } else if (strcmp (override, CHARLIE) == 0) {
142 } else if (strcmp (override, DELTA) == 0) {
144 } else if (strcmp (override, ECHO) == 0) {
147 printf ("Invalid SSL_VARIANT value: %s\n",
151 snprintf(recommand, 1024, "%%PREFIX%%/%s/bin/%s",
155 if (sslver == NULL) {
156 snprintf(recommand, 1024, "%%PREFIX%%/%s/bin/%s",
158 if (access(recommand, F_OK) != -1) { sslver = ZULU; };
160 if (sslver == NULL && ZULU != ALPHA) {
161 snprintf(recommand, 1024, "%%PREFIX%%/%s/bin/%s",
163 if (access(recommand, F_OK) != -1) { sslver = ALPHA; };
165 if (sslver == NULL && ZULU != BRAVO) {
166 snprintf(recommand, 1024, "%%PREFIX%%/%s/bin/%s",
168 if (access(recommand, F_OK) != -1) { sslver = BRAVO; };
170 if (sslver == NULL && ZULU != CHARLIE) {
171 snprintf(recommand, 1024, "%%PREFIX%%/%s/bin/%s",
173 if (access(recommand, F_OK) != -1) { sslver = CHARLIE; };
175 if (sslver == NULL && ZULU != DELTA) {
176 snprintf(recommand, 1024, "%%PREFIX%%/%s/bin/%s",
178 if (access(recommand, F_OK) != -1) { sslver = DELTA; };
180 if (sslver == NULL && ZULU != ECHO) {
181 snprintf(recommand, 1024, "%%PREFIX%%/%s/bin/%s",
183 if (access(recommand, F_OK) != -1) { sslver = ECHO; };
185 if (sslver == NULL) {
186 printf ("No version of %s is installed.\n", cmd);
191 execv(recommand, argv);
194 * Execution failed, so write out an error message
196 printf ("Command execution failed: %s\n", recommand);
197 printf (" arguments:");
198 for (x = 1; x < argc; x++)
199 printf (" %s", argv[x]);