-
Notifications
You must be signed in to change notification settings - Fork 4
/
mlc-create-owrt-mother.sh
executable file
·69 lines (50 loc) · 2.08 KB
/
mlc-create-owrt-mother.sh
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
68
69
#!/bin/bash
# set -x
# Copyright (c) 2011 Axel Neumann
# This program is free software; you can redistribute it and/or
# modify it under the terms of version 2 of the GNU General Public
# License as published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA
# WARNING:
# This package requires root priveleges and may have bugs that format your hard disk!!!!
# Use on your own risk! It is highly recommended to use provided scripts ONLY in
# a completely isolated environment like qemu or virtual box
if [ -f ./mlc-vars.sh ] ; then
. ./mlc-vars.sh
else
echo "could not find mlc-vars.sh in $(pwd)"; exit 1
fi
mother_name="${mlc_name_prefix}${mlc_mother_id}"
mother_config="$mlc_conf_dir/$mother_name"
mother_rootfs="$mlc_conf_dir/$mother_name/rootfs"
MLC_assign_networks $mlc_mother_id
echo "input returned $? and mlc_conf_dir=$mlc_conf_dir mother_name=$mother_name"
printf "\n"
printf "creating %s in %s\n" $mother_name $mother_config
[ -d ] $mother_config.old.old && rm -rf $mother_config.old.old
[ -d ] $mother_config.old && mv $mother_config.old $mother_config.old.old
[ -d ] $mother_config && mv $mother_config $mother_config.old
mkdir -p $mother_config $mother_rootfs
tar -C $mother_rootfs -xzvf $mlc_owrt_fs_tgz
cat <<EOF > $mother_rootfs/etc/inittab
::sysinit:/etc/init.d/rcS S boot
::shutdown:/etc/init.d/rcS K stop
console::askfirst:/bin/ash --login
#tts/0::askfirst:/bin/ash --login
#ttyS0::askfirst:/bin/ash --login
tty1::askfirst:/bin/ash --login
tty2::askfirst:/bin/ash --login
tty3::askfirst:/bin/ash --login
tty4::askfirst:/bin/ash --login
EOF
MLC_create_lxc_config $mother_rootfs $mother_config
echo "finished"