xref: /aosp_15_r20/external/toybox/post_update.sh (revision cf5a6c84e2b8763fc1a7db14496fd4742913b199)
1#!/bin/bash
2
3# external-updater provides:
4# $1 Path to the new version.
5# $2 Path to the old version.
6
7if [ "$#" -lt 1 ]; then
8  echo 'need at least the path to the current version!'
9  exit 1
10fi
11cd $1
12
13set -e
14
15rm -rf .config generated/ android/
16
17function generate() {
18  which=$1
19  echo -e "\n-------- $1\n"
20
21  # These are the only generated files we actually need.
22  files="config.h flags.h globals.h help.h newtoys.h tags.h"
23
24  cp config-$which .config
25  NOBUILD=1 scripts/make.sh
26  out=android/$which/generated/
27  mkdir -p $out
28  for f in $files; do cp generated/$f $out/$f ; done
29  rm -rf .config generated/
30
31  make allnoconfig KCONFIG_ALLCONFIG=config-$which
32}
33
34generate "device"
35generate "linux"
36generate "mac"
37
38rm -rf .config
39