File: mkconfigs

package info (click to toggle)
swupdate 2025.12%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 10,004 kB
  • sloc: ansic: 66,621; python: 6,291; makefile: 791; sh: 538; javascript: 229
file content (67 lines) | stat: -rwxr-xr-x 1,641 bytes parent folder | download | duplicates (6)
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/bin/sh
#
# Copyright (C) 2002 Khalid Aziz <khalid_aziz at hp.com>
# Copyright (C) 2002 Randy Dunlap <rddunlap at osdl.org>
# Copyright (C) 2002 Al Stone <ahs3 at fc.hp.com>
# Copyright (C) 2002 Hewlett-Packard Company
#
# SPDX-License-Identifier:     GPL-2.0-or-later
#
#   Busybox version by Matteo Croce <3297627799 at wind.it>
#
#   This script is taken from busybox projects - only file names
#   were changed.
#
# Rules to generate swupdateopts.h from .config:
#      - Retain lines that begin with "CONFIG_"
#      - Retain lines that begin with "# CONFIG_"
#      - lines that use double-quotes must \\-escape-quote them

config=.config

{
echo "\
#ifndef _SWCONFIGOPTS_H
#define _SWCONFIGOPTS_H
/*
 * swupdate configuration settings.
 *
 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
 *
 * This file is generated automatically by scripts/mkconfigs.
 * Do not edit.
 */
static const char swupdateconfig_config[] ALIGN1 ="

grep -e '^# CONFIG_' -e '^CONFIG_' "$config" \
| sed -e 's/\"/\\\"/g' -e 's/^/"/' -e 's/$/\\n"/'

echo ";"
echo "#endif"
} >"$1"

{
echo "\
#ifndef _SWCONFIGOPTS_BZ2_H
#define _SWCONFIGOPTS_BZ2_H
/*
 * swupdate configuration settings.
 *
 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
 *
 * This file is generated automatically by scripts/mkconfigs.
 * Do not edit.
 */
static const char swconfig_config_bz2[] ALIGN1 = {"

grep -e '^# CONFIG_' -e '^CONFIG_' "$config" \
| bzip2 -1 | dd bs=2 skip=1 2>/dev/null \
| od -v -t x1 \
| sed -e 's/^[^ ]*//' \
        -e 's/ //g' \
        -e '/^$/d' \
        -e 's/\(..\)/0x\1,/g'

echo "};"
echo "#endif"
} >"$2"