ext-toolchain.sh 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646
  1. #!/usr/bin/env bash
  2. #
  3. # Script for various external toolchain tasks, refer to
  4. # the --help output for more information.
  5. #
  6. # Copyright (C) 2012 Jo-Philipp Wich <[email protected]>
  7. #
  8. # This program is free software; you can redistribute it and/or modify
  9. # it under the terms of the GNU General Public License as published by
  10. # the Free Software Foundation; either version 2 of the License, or
  11. # (at your option) any later version.
  12. #
  13. # This program is distributed in the hope that it will be useful,
  14. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. # GNU General Public License for more details.
  17. #
  18. # You should have received a copy of the GNU General Public License
  19. # along with this program; if not, write to the Free Software
  20. # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  21. CC=""
  22. CXX=""
  23. CPP=""
  24. CFLAGS=""
  25. TOOLCHAIN="."
  26. LIBC_TYPE=""
  27. GCC_VERSION=""
  28. # Library specs
  29. LIB_SPECS="
  30. c: ld-* lib{anl,c,cidn,crypt,dl,m,nsl,nss_dns,nss_files,resolv,util}
  31. rt: librt-* librt
  32. pthread: libpthread-* libpthread
  33. stdcpp: libstdc++
  34. thread_db: libthread-db
  35. gcc: libgcc_s
  36. ssp: libssp
  37. gfortran: libgfortran
  38. gomp: libgomp
  39. atomic: libatomic
  40. quadmath: libquadmath
  41. asan: libasan
  42. tasan: libtsan
  43. lasan: liblsan
  44. ubasan: libubsan
  45. "
  46. # Binary specs
  47. BIN_SPECS="
  48. ldd: ldd
  49. ldconfig: ldconfig
  50. gdb: gdb
  51. gdbserver: gdbserver
  52. "
  53. OVERWRITE_CONFIG=""
  54. test_c() {
  55. cat <<-EOT | "${CC:-false}" $CFLAGS -o /dev/null -x c - 2>/dev/null
  56. #include <stdio.h>
  57. int main(int argc, char **argv)
  58. {
  59. printf("Hello, world!\n");
  60. return 0;
  61. }
  62. EOT
  63. }
  64. test_cxx() {
  65. cat <<-EOT | "${CXX:-false}" $CFLAGS -o /dev/null -x c++ - 2>/dev/null
  66. #include <iostream>
  67. using namespace std;
  68. int main()
  69. {
  70. cout << "Hello, world!" << endl;
  71. return 0;
  72. }
  73. EOT
  74. }
  75. test_softfloat() {
  76. cat <<-EOT | "$CC" $CFLAGS -msoft-float -o /dev/null -x c - 2>/dev/null
  77. int main(int argc, char **argv)
  78. {
  79. double a = 0.1;
  80. double b = 0.2;
  81. double c = (a + b) / (a * b);
  82. return 1;
  83. }
  84. EOT
  85. }
  86. test_uclibc() {
  87. local sysroot="$("$CC" $CFLAGS -print-sysroot 2>/dev/null)"
  88. if [ -d "${sysroot:-$TOOLCHAIN}" ]; then
  89. local lib
  90. for lib in "${sysroot:-$TOOLCHAIN}"/{lib,usr/lib,usr/local/lib}/ld*-uClibc*.so*; do
  91. if [ -f "$lib" ] && [ ! -h "$lib" ]; then
  92. return 0
  93. fi
  94. done
  95. fi
  96. return 1
  97. }
  98. test_feature() {
  99. local feature="$1"; shift
  100. # find compilers, libc type
  101. probe_cc
  102. probe_cxx
  103. probe_libc
  104. # common toolchain feature tests
  105. case "$feature" in
  106. c) test_c; return $? ;;
  107. c++) test_cxx; return $? ;;
  108. soft*) test_softfloat; return $? ;;
  109. esac
  110. # assume eglibc/glibc supports all libc features
  111. if [ "$LIBC_TYPE" != "uclibc" ]; then
  112. return 0
  113. fi
  114. # uclibc feature tests
  115. local inc
  116. local sysroot="$("$CC" "$@" -muclibc -print-sysroot 2>/dev/null)"
  117. for inc in "include" "usr/include" "usr/local/include"; do
  118. local conf="${sysroot:-$TOOLCHAIN}/$inc/bits/uClibc_config.h"
  119. if [ -f "$conf" ]; then
  120. case "$feature" in
  121. lfs) grep -q '__UCLIBC_HAS_LFS__ 1' "$conf"; return $?;;
  122. ipv6) grep -q '__UCLIBC_HAS_IPV6__ 1' "$conf"; return $?;;
  123. rpc) grep -q '__UCLIBC_HAS_RPC__ 1' "$conf"; return $?;;
  124. locale) grep -q '__UCLIBC_HAS_LOCALE__ 1' "$conf"; return $?;;
  125. wchar) grep -q '__UCLIBC_HAS_WCHAR__ 1' "$conf"; return $?;;
  126. threads) grep -q '__UCLIBC_HAS_THREADS__ 1' "$conf"; return $?;;
  127. esac
  128. fi
  129. done
  130. return 1
  131. }
  132. find_libs() {
  133. local spec="$(echo "$LIB_SPECS" | sed -ne "s#^[[:space:]]*$1:##ip")"
  134. if [ -n "$spec" ] && probe_cpp; then
  135. local libdir libdirs
  136. for libdir in $(
  137. "$CPP" $CFLAGS -v -x c /dev/null 2>&1 | \
  138. sed -ne 's#:# #g; s#^LIBRARY_PATH=##p'
  139. ); do
  140. if [ -d "$libdir" ]; then
  141. libdirs="$libdirs $(cd "$libdir"; pwd)/"
  142. fi
  143. done
  144. local pattern
  145. for pattern in $(eval echo $spec); do
  146. find $libdirs -name "$pattern.so*" | sort -u
  147. done
  148. return 0
  149. fi
  150. return 1
  151. }
  152. find_bins() {
  153. local spec="$(echo "$BIN_SPECS" | sed -ne "s#^[[:space:]]*$1:##ip")"
  154. if [ -n "$spec" ] && probe_cpp; then
  155. local sysroot="$("$CPP" -print-sysroot)"
  156. local bindir bindirs
  157. for bindir in $(
  158. echo "${sysroot:-$TOOLCHAIN}/bin";
  159. echo "${sysroot:-$TOOLCHAIN}/usr/bin";
  160. echo "${sysroot:-$TOOLCHAIN}/usr/local/bin";
  161. "$CPP" $CFLAGS -v -x c /dev/null 2>&1 | \
  162. sed -ne 's#:# #g; s#^COMPILER_PATH=##p'
  163. ); do
  164. if [ -d "$bindir" ]; then
  165. bindirs="$bindirs $(cd "$bindir"; pwd)/"
  166. fi
  167. done
  168. local pattern
  169. for pattern in $(eval echo $spec); do
  170. find $bindirs -name "$pattern" | sort -u
  171. done
  172. return 0
  173. fi
  174. return 1
  175. }
  176. find_gcc_version() {
  177. if [ -f $TOOLCHAIN/info.mk ]; then
  178. GCC_VERSION=$(grep GCC_VERSION $TOOLCHAIN/info.mk | sed 's/GCC_VERSION=//')
  179. return 0
  180. fi
  181. echo "Warning! Can't find info.mk, trying to detect with alternative way."
  182. # Very fragile detection
  183. GCC_VERSION=$(find $TOOLCHAIN/bin | grep -oE "gcc-[0-9]+\.[0-9]+\.[0-9]+$" | \
  184. head -1 | sed 's/gcc-//')
  185. }
  186. wrap_bin_cc() {
  187. local out="$1"
  188. local bin="$2"
  189. echo '#!/bin/sh' > "$out"
  190. echo 'for arg in "$@"; do' >> "$out"
  191. echo ' case "$arg" in -l*|-L*|-shared|-static)' >> "$out"
  192. echo -n ' exec "'"$bin"'" '"$CFLAGS"' ${STAGING_DIR:+' >> "$out"
  193. echo -n '-idirafter "$STAGING_DIR/usr/include" ' >> "$out"
  194. echo -n '-L "$STAGING_DIR/usr/lib" ' >> "$out"
  195. echo '-Wl,-rpath-link,"$STAGING_DIR/usr/lib"} "$@" ;;' >> "$out"
  196. echo ' esac' >> "$out"
  197. echo 'done' >> "$out"
  198. echo -n 'exec "'"$bin"'" '"$CFLAGS"' ${STAGING_DIR:+' >> "$out"
  199. echo '-idirafter "$STAGING_DIR/usr/include"} "$@"' >> "$out"
  200. chmod +x "$out"
  201. }
  202. wrap_bin_ld() {
  203. local out="$1"
  204. local bin="$2"
  205. echo '#!/bin/sh' > "$out"
  206. echo -n 'exec "'"$bin"'" ${STAGING_DIR:+' >> "$out"
  207. echo -n '-L "$STAGING_DIR/usr/lib" ' >> "$out"
  208. echo '-rpath-link "$STAGING_DIR/usr/lib"} "$@"' >> "$out"
  209. chmod +x "$out"
  210. }
  211. wrap_bin_other() {
  212. local out="$1"
  213. local bin="$2"
  214. echo '#!/bin/sh' > "$out"
  215. echo 'exec "'"$bin"'" "$@"' >> "$out"
  216. chmod +x "$out"
  217. }
  218. wrap_bins() {
  219. if probe_cc; then
  220. mkdir -p "$1" || return 1
  221. local cmd
  222. for cmd in "${CC%-*}-"*; do
  223. if [ -x "$cmd" ]; then
  224. local out="$1/${cmd##*/}"
  225. local bin="$cmd"
  226. if [ -x "$out" ] && ! grep -q STAGING_DIR "$out"; then
  227. mv "$out" "$out.bin"
  228. bin='$(dirname "$0")/'"${out##*/}"'.bin'
  229. fi
  230. case "${cmd##*/}" in
  231. *-*cc|*-*cc-*|*-*++|*-*++-*|*-cpp)
  232. wrap_bin_cc "$out" "$bin"
  233. ;;
  234. *-ld)
  235. wrap_bin_ld "$out" "$bin"
  236. ;;
  237. *)
  238. wrap_bin_other "$out" "$bin"
  239. ;;
  240. esac
  241. fi
  242. done
  243. return 0
  244. fi
  245. return 1
  246. }
  247. print_config() {
  248. local mktarget="$1"
  249. local mksubtarget
  250. local target="$("$CC" $CFLAGS -dumpmachine)"
  251. local version="$("$CC" $CFLAGS -dumpversion)"
  252. local cpuarch="${target%%-*}"
  253. # get CC; strip version; strip gcc and add - suffix
  254. local prefix="${CC##*/}"; prefix="${prefix%-$version}"; prefix="${prefix%-*}-"
  255. local config="${0%/scripts/*}/.config"
  256. # if no target specified, print choice list and exit
  257. if [ -z "$mktarget" ]; then
  258. # prepare metadata
  259. if [ ! -f "${0%/scripts/*}/tmp/.targetinfo" ]; then
  260. "${0%/*}/scripts/config/mconf" prepare-tmpinfo
  261. fi
  262. local mktargets=$(
  263. sed -ne "
  264. /^Target: / { h };
  265. /^Target-Arch: $cpuarch\$/ { x; s#^Target: ##p }
  266. " "${0%/scripts/*}/tmp/.targetinfo" | sort -u
  267. )
  268. for mktarget in $mktargets; do
  269. case "$mktarget" in */*)
  270. mktargets=$(echo "$mktargets" | sed -e "/^${mktarget%/*}\$/d")
  271. esac
  272. done
  273. if [ -n "$mktargets" ]; then
  274. echo "Available targets:" >&2
  275. echo $mktargets >&2
  276. else
  277. echo -e "Could not find a suitable OpenWrt target for " >&2
  278. echo -e "CPU architecture '$cpuarch' - you need to " >&2
  279. echo -e "define one first!" >&2
  280. fi
  281. return 1
  282. fi
  283. # bail out if there is a .config already
  284. if [ -f "$config" ]; then
  285. if [ "$OVERWRITE_CONFIG" == "" ]; then
  286. echo "There already is a .config file, refusing to overwrite!" >&2
  287. return 1
  288. else
  289. echo "There already is a .config file, trying to overwrite!"
  290. fi
  291. fi
  292. case "$mktarget" in */*)
  293. mksubtarget="${mktarget#*/}"
  294. mktarget="${mktarget%/*}"
  295. ;; esac
  296. if [ ! -f "$config" ]; then
  297. touch "$config"
  298. fi
  299. echo "CONFIG_TARGET_${mktarget}=y" >> "$config"
  300. if [ -n "$mksubtarget" ]; then
  301. echo "CONFIG_TARGET_${mktarget}_${mksubtarget}=y" >> "$config"
  302. fi
  303. if test_feature "softfloat"; then
  304. echo "CONFIG_SOFT_FLOAT=y" >> "$config"
  305. else
  306. echo "# CONFIG_SOFT_FLOAT is not set" >> "$config"
  307. fi
  308. if test_feature "ipv6"; then
  309. echo "CONFIG_IPV6=y" >> "$config"
  310. else
  311. echo "# CONFIG_IPV6 is not set" >> "$config"
  312. fi
  313. if test_feature "locale"; then
  314. echo "CONFIG_BUILD_NLS=y" >> "$config"
  315. else
  316. echo "# CONFIG_BUILD_NLS is not set" >> "$config"
  317. fi
  318. echo "CONFIG_DEVEL=y" >> "$config"
  319. echo "CONFIG_EXTERNAL_TOOLCHAIN=y" >> "$config"
  320. echo "CONFIG_TOOLCHAIN_ROOT=\"$TOOLCHAIN\"" >> "$config"
  321. echo "CONFIG_TOOLCHAIN_PREFIX=\"$prefix\"" >> "$config"
  322. echo "CONFIG_TARGET_NAME=\"$target\"" >> "$config"
  323. if [ -f "$config" ]; then
  324. sed -i '/CONFIG_EXTERNAL_TOOLCHAIN_LIBC_USE_MUSL/d' "$config"
  325. sed -i '/CONFIG_EXTERNAL_TOOLCHAIN_LIBC_USE_GLIBC/d' "$config"
  326. fi
  327. if [ "$LIBC_TYPE" == glibc ]; then
  328. echo "CONFIG_EXTERNAL_TOOLCHAIN_LIBC_USE_GLIBC=y" >> "$config"
  329. elif [ "$LIBC_TYPE" == musl ]; then
  330. echo "CONFIG_EXTERNAL_TOOLCHAIN_LIBC_USE_MUSL=y" >> "$config"
  331. else
  332. echo "Can't detect LIBC type. Aborting!" >&2
  333. return 1
  334. fi
  335. if [ -n "$GCC_VERSION" ]; then
  336. echo "CONFIG_EXTERNAL_GCC_VERSION=\"$GCC_VERSION\"" >> "$config"
  337. else
  338. echo "Can't detect GCC version. Aborting!" >&2
  339. return 1
  340. fi
  341. local lib
  342. for lib in C RT PTHREAD GCC STDCPP SSP GFORTRAN GOMP ATOMIC QUADMATH ASAN TSAN LSAN UBSAN; do
  343. local file
  344. local spec=""
  345. local llib="$(echo "$lib" | sed -e 's#.*#\L&#')"
  346. for file in $(find_libs "$lib"); do
  347. spec="${spec:+$spec }$(echo "$file" | sed -e "s#^$TOOLCHAIN#.#")"
  348. done
  349. if [ -n "$spec" ]; then
  350. echo "CONFIG_PACKAGE_lib${llib}=y" >> "$config"
  351. echo "CONFIG_LIB${lib}_FILE_SPEC=\"$spec\"" >> "$config"
  352. else
  353. echo "# CONFIG_PACKAGE_lib${llib} is not set" >> "$config"
  354. fi
  355. done
  356. local bin
  357. for bin in LDD LDCONFIG; do
  358. local file
  359. local spec=""
  360. local lbin="$(echo "$bin" | sed -e 's#.*#\L&#')"
  361. for file in $(find_bins "$bin"); do
  362. spec="${spec:+$spec }$(echo "$file" | sed -e "s#^$TOOLCHAIN#.#")"
  363. done
  364. if [ -n "$spec" ]; then
  365. echo "CONFIG_PACKAGE_${lbin}=y" >> "$config"
  366. echo "CONFIG_${bin}_FILE_SPEC=\"$spec\"" >> "$config"
  367. else
  368. echo "# CONFIG_PACKAGE_${lbin} is not set" >> "$config"
  369. fi
  370. done
  371. # inflate
  372. make -C "${0%/scripts/*}" defconfig
  373. return 0
  374. }
  375. probe_cc() {
  376. if [ -z "$CC" ]; then
  377. local bin
  378. for bin in "bin" "usr/bin" "usr/local/bin"; do
  379. local cmd
  380. for cmd in "$TOOLCHAIN/$bin/"*-*cc*; do
  381. if [ -x "$cmd" ] && [ ! -h "$cmd" ]; then
  382. CC="$(cd "${cmd%/*}"; pwd)/${cmd##*/}"
  383. return 0
  384. fi
  385. done
  386. done
  387. return 1
  388. fi
  389. return 0
  390. }
  391. probe_cxx() {
  392. if [ -z "$CXX" ]; then
  393. local bin
  394. for bin in "bin" "usr/bin" "usr/local/bin"; do
  395. local cmd
  396. for cmd in "$TOOLCHAIN/$bin/"*-*++*; do
  397. if [ -x "$cmd" ] && [ ! -h "$cmd" ]; then
  398. CXX="$(cd "${cmd%/*}"; pwd)/${cmd##*/}"
  399. return 0
  400. fi
  401. done
  402. done
  403. return 1
  404. fi
  405. return 0
  406. }
  407. probe_cpp() {
  408. if [ -z "$CPP" ]; then
  409. local bin
  410. for bin in "bin" "usr/bin" "usr/local/bin"; do
  411. local cmd
  412. for cmd in "$TOOLCHAIN/$bin/"*-cpp*; do
  413. if [ -x "$cmd" ] && [ ! -h "$cmd" ]; then
  414. CPP="$(cd "${cmd%/*}"; pwd)/${cmd##*/}"
  415. return 0
  416. fi
  417. done
  418. done
  419. return 1
  420. fi
  421. return 0
  422. }
  423. probe_libc() {
  424. if [ -f $TOOLCHAIN/info.mk ]; then
  425. LIBC_TYPE=$(grep LIBC_TYPE $TOOLCHAIN/info.mk | sed 's/LIBC_TYPE=//')
  426. return 0
  427. fi
  428. echo "Warning! Can't find info.mk, trying to detect with alternative way."
  429. if [ -z "$LIBC_TYPE" ]; then
  430. if test_uclibc; then
  431. LIBC_TYPE="uclibc"
  432. else
  433. LIBC_TYPE="glibc"
  434. fi
  435. fi
  436. return 0
  437. }
  438. while [ -n "$1" ]; do
  439. arg="$1"; shift
  440. case "$arg" in
  441. --toolchain)
  442. [ -d "$1" ] || {
  443. echo "Toolchain directory '$1' does not exist." >&2
  444. exit 1
  445. }
  446. TOOLCHAIN="$(cd "$1"; pwd)"; shift
  447. ;;
  448. --cflags)
  449. CFLAGS="${CFLAGS:+$CFLAGS }$1"; shift
  450. ;;
  451. --print-libc)
  452. if probe_cc; then
  453. probe_libc
  454. echo "$LIBC_TYPE"
  455. exit 0
  456. fi
  457. echo "No C compiler found in '$TOOLCHAIN'." >&2
  458. exit 1
  459. ;;
  460. --print-target)
  461. if probe_cc; then
  462. exec "$CC" $CFLAGS -dumpmachine
  463. fi
  464. echo "No C compiler found in '$TOOLCHAIN'." >&2
  465. exit 1
  466. ;;
  467. --print-bin)
  468. if [ -z "$1" ]; then
  469. echo "Available programs:" >&2
  470. echo $(echo "$BIN_SPECS" | sed -ne 's#:.*$##p') >&2
  471. exit 1
  472. fi
  473. find_bins "$1" || exec "$0" --toolchain "$TOOLCHAIN" --print-bin
  474. exit 0
  475. ;;
  476. --print-libs)
  477. if [ -z "$1" ]; then
  478. echo "Available libraries:" >&2
  479. echo $(echo "$LIB_SPECS" | sed -ne 's#:.*$##p') >&2
  480. exit 1
  481. fi
  482. find_libs "$1" || exec "$0" --toolchain "$TOOLCHAIN" --print-libs
  483. exit 0
  484. ;;
  485. --test)
  486. test_feature "$1"
  487. exit $?
  488. ;;
  489. --wrap)
  490. [ -n "$1" ] || exec "$0" --help
  491. wrap_bins "$1"
  492. exit $?
  493. ;;
  494. --overwrite-config)
  495. OVERWRITE_CONFIG=y
  496. ;;
  497. --config)
  498. if probe_cc; then
  499. probe_libc
  500. find_gcc_version
  501. print_config "$1"
  502. exit $?
  503. fi
  504. echo "No C compiler found in '$TOOLCHAIN'." >&2
  505. exit 1
  506. ;;
  507. -h|--help)
  508. me="$(basename "$0")"
  509. echo -e "\nUsage:\n" >&2
  510. echo -e " $me --toolchain {directory} --print-libc" >&2
  511. echo -e " Print the libc implementation and exit.\n" >&2
  512. echo -e " $me --toolchain {directory} --print-target" >&2
  513. echo -e " Print the GNU target name and exit.\n" >&2
  514. echo -e " $me --toolchain {directory} --print-bin {program}" >&2
  515. echo -e " Print executables belonging to given program," >&2
  516. echo -e " omit program argument to get a list of names.\n" >&2
  517. echo -e " $me --toolchain {directory} --print-libs {library}" >&2
  518. echo -e " Print shared objects belonging to given library," >&2
  519. echo -e " omit library argument to get a list of names.\n" >&2
  520. echo -e " $me --toolchain {directory} --test {feature}" >&2
  521. echo -e " Test given feature, exit code indicates success." >&2
  522. echo -e " Possible features are 'c', 'c++', 'softfloat'," >&2
  523. echo -e " 'lfs', 'rpc', 'ipv6', 'wchar', 'locale' and " >&2
  524. echo -e " 'threads'.\n" >&2
  525. echo -e " $me --toolchain {directory} --wrap {directory}" >&2
  526. echo -e " Create wrapper scripts for C and C++ compiler, " >&2
  527. echo -e " linker, assembler and other key executables in " >&2
  528. echo -e " the directory given with --wrap.\n" >&2
  529. echo -e " $me --toolchain {directory} --config {target}" >&2
  530. echo -e " Analyze the given toolchain and print a suitable" >&2
  531. echo -e " .config for the given target. Omit target " >&2
  532. echo -e " argument to get a list of names.\n" >&2
  533. echo -e " $me --help" >&2
  534. echo -e " Display this help text and exit.\n\n" >&2
  535. echo -e " Most commands also take a --cflags parameter which " >&2
  536. echo -e " is used to specify C flags to be passed to the " >&2
  537. echo -e " cross compiler when performing tests." >&2
  538. echo -e " This parameter may be repeated multiple times." >&2
  539. echo -e " Use --overwrite-config before --config to overwrite" >&2
  540. echo -e " an already present config with the required changes.">&2
  541. exit 1
  542. ;;
  543. *)
  544. echo "Unknown argument '$arg'" >&2
  545. exec $0 --help
  546. ;;
  547. esac
  548. done
  549. exec $0 --help