Ravenports generated: 31 Jan 2019 12:37
[ravenports.git] / bucket_BC / ravensys-uname
1 # Buildsheet autogenerated by ravenadm tool -- Do not edit.
2
3 NAMEBASE=               ravensys-uname
4 VERSION=                1.0
5 KEYWORDS=               raven sysutils
6 VARIANTS=               standard
7 SDESC[standard]=        Fake uname for raven-sysroot
8 HOMEPAGE=               none
9 CONTACT=                John_Marino[draco@marino.st]
10
11 DOWNLOAD_GROUPS=        none
12 SPKGS[standard]=        single
13
14 OPTIONS_AVAILABLE=      none
15 OPTIONS_STANDARD=       none
16
17 LICENSE=                BSD2CLAUSE:single
18 LICENSE_FILE=           BSD2CLAUSE:{{FILESDIR}}/LICENSE
19 LICENSE_SCHEME=         solo
20
21 do-extract:
22         ${MKDIR} ${WRKSRC}
23         ${SED} -e 's|@OPSYS@|${OPSYS}|g' \
24                 -e 's|@ARCH@|${SET_ARCH}|g' \
25                 -e 's|@PLATFORM@|${SET_PLATFORM}|g' \
26                 -e 's|@RELEASE@|${SET_RELEASE}-RAVEN|g' \
27                 -e 's|@USERVER@|${OSVERSION}|g' \
28                 ${FILESDIR}/uname.c.in > ${WRKSRC}/uname.c
29
30 do-build:
31         (cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} \
32                 ${CC} -o ravensys-uname uname.c ${CFLAGS})
33
34 do-install:
35         ${INSTALL_PROGRAM} ${WRKSRC}/ravensys-uname ${STAGEDIR}${PREFIX}/bin/
36
37 [FILE:50:descriptions/desc.single]
38 Fake uname for explicit use with ravenports jail.
39
40
41 [FILE:19:manifests/plist.single]
42 bin/ravensys-uname
43
44
45 [FILE:1862:files/LICENSE]
46 /*-
47  * Copyright (c) 2002 Juli Mallett.
48  * Copyright (c) 1993
49  *      The Regents of the University of California.  All rights reserved.
50  *
51  * Redistribution and use in source and binary forms, with or without
52  * modification, are permitted provided that the following conditions
53  * are met:
54  * 1. Redistributions of source code must retain the above copyright
55  *    notice, this list of conditions and the following disclaimer.
56  * 2. Redistributions in binary form must reproduce the above copyright
57  *    notice, this list of conditions and the following disclaimer in the
58  *    documentation and/or other materials provided with the distribution.
59  * 3. All advertising materials mentioning features or use of this software
60  *    must display the following acknowledgement:
61  *      This product includes software developed by the University of
62  *      California, Berkeley and its contributors.
63  * 4. Neither the name of the University nor the names of its contributors
64  *    may be used to endorse or promote products derived from this software
65  *    without specific prior written permission.
66  *
67  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
68  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
69  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
70  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
71  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
72  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
73  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
74  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
75  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
76  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
77  * SUCH DAMAGE.
78  */
79
80
81 [FILE:668:files/special.mk]
82 # add ARCH_STANDARD conditions as multiple arches per OPSYS
83 # become supported
84
85 .if ${OPSYS:MFreeBSD}
86 SET_ARCH=       amd64
87 SET_PLATFORM=   amd64
88 SET_RELEASE=    ${OSREL}
89 .elif ${OPSYS:MDragonFly}
90 SET_ARCH=       x86_64
91 SET_PLATFORM=   x86_64
92 SET_RELEASE=    ${OSREL}
93 .elif ${OPSYS:MNetBSD}
94 SET_ARCH=       amd64
95 SET_PLATFORM=   amd64
96 SET_RELEASE=    ${OSREL}
97 .elif ${OPSYS:MOpenBSD}
98 SET_ARCH=       amd64
99 SET_PLATFORM=   amd64
100 SET_RELEASE=    ${OSREL}
101 .elif ${OPSYS:MDarwin}
102 SET_ARCH=       i386
103 SET_PLATFORM=   x86_64
104 SET_RELEASE=    ${MAJOR}
105 .elif ${OPSYS:MSunOS}
106 SET_ARCH=       x86_64  #check
107 SET_PLATFORM=   x86_64
108 SET_RELEASE=    ${OSREL}
109 .elif ${OPSYS:MLinux}
110 SET_ARCH=       x86_64
111 SET_PLATFORM=   x86_64
112 SET_RELEASE=    ${OSREL}
113 .endif
114
115
116 [FILE:2145:files/uname.c.in]
117 #ifndef __sun__
118 #include <err.h>
119 #endif
120 #include <stdio.h>
121 #include <stdlib.h>
122 #include <unistd.h>
123 #ifdef __APPLE__
124 #define u_int   unsigned int
125 #endif
126
127 #define MFLAG   0x01
128 #define NFLAG   0x02
129 #define PFLAG   0x04
130 #define RFLAG   0x08
131 #define SFLAG   0x10
132 #define VFLAG   0x20
133 #define IFLAG   0x40
134 #define UFLAG   0x80
135
136 static void print_uname(u_int);
137 static void usage(void);
138
139 static const char *sysname  = "@OPSYS@";
140 static const char *arch     = "@ARCH@";
141 static const char *platform = "@PLATFORM@";
142 static const char *release  = "@RELEASE@";
143 static const char *uservers = "@USERVER@";
144 static const char *ident    = "GENERIC";
145 static const char *version  = "@OPSYS@ @RELEASE@ #0 Sat Jul 29 09:00:00 CDT 2017 root@octavia.unreal.systems:/usr/obj/usr/src/sys/GENERIC";
146 static const char *hostname = "octavia.unreal.systems";
147 static int space;
148
149 int
150 main(int argc, char *argv[])
151 {
152         u_int flags;
153         int ch;
154
155         flags = 0;
156
157         while ((ch = getopt(argc, argv, "aimnoprsUv")) != -1)
158                 switch(ch) {
159                 case 'a':
160                         flags |= (MFLAG | NFLAG | RFLAG | SFLAG | VFLAG);
161                         break;
162                 case 'i':
163                         flags |= IFLAG;
164                         break;
165                 case 'm':
166                         flags |= MFLAG;
167                         break;
168                 case 'n':
169                         flags |= NFLAG;
170                         break;
171                 case 'p':
172                         flags |= PFLAG;
173                         break;
174                 case 'r':
175                         flags |= RFLAG;
176                         break;
177                 case 's':
178                 case 'o':
179                         flags |= SFLAG;
180                         break;
181                 case 'U':
182                         flags |= UFLAG;
183                         break;
184                 case 'v':
185                         flags |= VFLAG;
186                         break;
187                 case '?':
188                 default:
189                         usage();
190                 }
191
192         argc -= optind;
193         argv += optind;
194
195         if (argc)
196                 usage();
197
198         if (!flags)
199                 flags |= SFLAG;
200
201         print_uname(flags);
202         exit(0);
203 }
204
205 #define PRINT_FLAG(flags,flag,var)              \
206         if ((flags & flag) == flag) {           \
207                 if (space)                      \
208                         printf(" ");            \
209                 else                            \
210                         space++;                \
211                 printf("%s", var);              \
212         }
213
214 static void
215 print_uname(u_int flags)
216 {
217         PRINT_FLAG(flags, SFLAG, sysname);
218         PRINT_FLAG(flags, NFLAG, hostname);
219         PRINT_FLAG(flags, RFLAG, release);
220         PRINT_FLAG(flags, VFLAG, version);
221         PRINT_FLAG(flags, MFLAG, platform);
222         PRINT_FLAG(flags, PFLAG, arch);
223         PRINT_FLAG(flags, IFLAG, ident);
224         PRINT_FLAG(flags, UFLAG, uservers);
225         printf("\n");
226 }
227
228 static void
229 usage(void)
230 {
231         fprintf(stderr, "usage: uname [-aiKmnoprsUv]\n");
232         exit(1);
233 }
234