forked from probonopd/minikrebs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprepare
executable file
·43 lines (40 loc) · 1.43 KB
/
prepare
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
#!/bin/bash
set -e
# $IMAGEBUILDER_URL can be an environment variable set outside this script
if [ -z "$IMAGEBUILDER_URL" ] ; then
IMAGEBUILDER_URL="https://downloads.openwrt.org/chaos_calmer/15.05/ar71xx/generic/OpenWrt-ImageBuilder-15.05-ar71xx-generic.Linux-x86_64.tar.bz2"
# IMAGEBUILDER_URL="https://downloads.openwrt.org/snapshots/trunk/ramips/generic/OpenWrt-ImageBuilder-ramips-rt305x.Linux-x86_64.tar.bz2"
# Caution: Snapshots are unstable
fi
cd $(dirname $(readlink -f $0))
git submodule update --init
if [ -z "${1:-}" ];then
echo "usage: $0 PROFILE"
echo
HIDE_TRAITS="true" sh $(dirname $(readlink -f $0))/bin/available_profiles
exit 1
fi
PROFILE=$1
if [ ! -e builder/init ]; then
wget --trust-server-names -c "$IMAGEBUILDER_URL"
tar xf $(basename "$IMAGEBUILDER_URL")
mv OpenWrt-*-x86_64 builder
echo "Builder successfully downloaded"
else
echo "Builder already installed, skipping download"
fi
echo
echo "copying generic init:"
cp --remove-destination lib/init builder/init
echo " profile/init -> builder/init"
cp --remove-destination lib/init_overlay builder/init_overlay
echo " profile/init_overlay -> builder/init_overlay"
[ -e builder/overlay ] && echo "removing old overlay" && rm -rf builder/overlay
echo
echo "copying profile:"
./copy_profile "$PROFILE"
if [ -e builder/overlay ];then
echo
echo "This profile also contains overlay data,"
echo 'run `builder/init_overlay` to copy'
fi