Improve the image command
This commit is contained in:
parent
3e88f85cc6
commit
4fccf12c69
Binary file not shown.
|
@ -28,20 +28,87 @@
|
|||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
IMAGE_TYPE=$1
|
||||
IMAGE_TYPE='beaglebone'
|
||||
CURR_DIR=$(pwd)
|
||||
BUILD_DIR=~/.tmp_freedombone_build
|
||||
VMDEBOOTSTRAP_REPO=git://git.liw.fi/vmdebootstrap
|
||||
VMDEBOOTSTRAP_VERSION=0.8
|
||||
MAKEFILE=freedombone-image-makefile
|
||||
|
||||
USERNAME=$(echo $USER)
|
||||
PASSWORD='freedombone'
|
||||
|
||||
# IP address of the router (gateway)
|
||||
ROUTER_IP_ADDRESS="192.168.1.254"
|
||||
|
||||
# The fixed IP address of the Beaglebone Black (or other SBC) on your local network
|
||||
BOX_IP_ADDRESS="192.168.1.55"
|
||||
|
||||
# DNS
|
||||
NAMESERVER1='213.73.91.35'
|
||||
NAMESERVER2='85.214.20.141'
|
||||
|
||||
while [[ $# > 1 ]]
|
||||
do
|
||||
key="$1"
|
||||
|
||||
case $key in
|
||||
-h|--help)
|
||||
show_help
|
||||
;;
|
||||
-t|--target|--board)
|
||||
shift
|
||||
IMAGE_TYPE="$1"
|
||||
;;
|
||||
-u|--user|--username)
|
||||
shift
|
||||
USERNAME="$1"
|
||||
;;
|
||||
-p|--password)
|
||||
shift
|
||||
PASSWORD="$1"
|
||||
;;
|
||||
# Box static IP address on the LAN
|
||||
--ip)
|
||||
shift
|
||||
BOX_IP_ADDRESS="$1"
|
||||
;;
|
||||
# Router IP address on the LAN
|
||||
--iprouter)
|
||||
shift
|
||||
ROUTER_IP_ADDRESS="$1"
|
||||
;;
|
||||
# nameserver 1
|
||||
--ns1|--nameserver1)
|
||||
shift
|
||||
NAMESERVER1="$1"
|
||||
;;
|
||||
# nameserver 2
|
||||
--ns2|--nameserver2)
|
||||
shift
|
||||
NAMESERVER2="$1"
|
||||
;;
|
||||
*)
|
||||
# unknown option
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
|
||||
|
||||
rm $CURR_DIR/*.img.bz2
|
||||
rm $CURR_DIR/*.img
|
||||
rm $CURR_DIR/*.sig
|
||||
|
||||
if [ -d $BUILD_DIR ]; then
|
||||
rm -rf $BUILD_DIR
|
||||
rm -rf $BUILD_DIR
|
||||
fi
|
||||
mkdir -p $BUILD_DIR
|
||||
if [ -f /usr/local/bin/freedombone-image-makefile ]; then
|
||||
cp /usr/local/bin/freedombone-image-makefile $BUILD_DIR/Makefile
|
||||
if [ -f /usr/local/bin/$MAKEFILE ]; then
|
||||
cp /usr/local/bin/$MAKEFILE $BUILD_DIR/Makefile
|
||||
else
|
||||
cp /usr/bin/freedombone-image-makefile $BUILD_DIR/Makefile
|
||||
cp /usr/bin/$MAKEFILE $BUILD_DIR/Makefile
|
||||
fi
|
||||
|
||||
cp -r /etc/freedombone/* $BUILD_DIR
|
||||
|
@ -52,18 +119,25 @@ mkdir vendor
|
|||
if [ -d vendor/vmdebootstrap ] ; then
|
||||
(cd vendor/vmdebootstrap; git checkout .; git pull)
|
||||
else
|
||||
git clone git://git.liw.fi/vmdebootstrap vendor/vmdebootstrap
|
||||
git clone $VMDEBOOTSTRAP_REPO vendor/vmdebootstrap
|
||||
fi
|
||||
cd vendor/vmdebootstrap
|
||||
git checkout tags/vmdebootstrap-0.8
|
||||
git checkout -b tags/vmdebootstrap-0.8
|
||||
git checkout tags/vmdebootstrap-${VMDEBOOTSTRAP_VERSION}
|
||||
git checkout -b tags/vmdebootstrap-${VMDEBOOTSTRAP_VERSION}
|
||||
for f in ../../vendor-patches/vmdebootstrap/* ; do
|
||||
echo applying $(basename $f)
|
||||
patch -p1 < $f
|
||||
done
|
||||
|
||||
cd $BUILD_DIR
|
||||
make $IMAGE_TYPE
|
||||
make $IMAGE_TYPE \
|
||||
USERNAME="$USERNAME" \
|
||||
PASSWORD="$PASSWORD" \
|
||||
ROUTER_IP_ADDRESS="$ROUTER_IP_ADDRESS" \
|
||||
BOX_IP_ADDRESS="$BOX_IP_ADDRESS" \
|
||||
NAMESERVER1="$NAMESERVER1" \
|
||||
NAMESERVER2="$NAMESERVER2"
|
||||
|
||||
mv build/*.bz2 $CURR_DIR
|
||||
mv build/*.img $CURR_DIR
|
||||
mv build/*.sig $CURR_DIR
|
||||
|
|
|
@ -18,6 +18,22 @@
|
|||
set -e
|
||||
set -x
|
||||
|
||||
# The number of arguments
|
||||
NO_OF_ARGS=$#
|
||||
|
||||
MY_USERNAME=$USER
|
||||
MY_PASSWORD='freedombone'
|
||||
|
||||
# IP address of the router (gateway)
|
||||
ROUTER_IP_ADDRESS="192.168.1.254"
|
||||
|
||||
# The fixed IP address of the Beaglebone Black on your local network
|
||||
BOX_IP_ADDRESS="192.168.1.55"
|
||||
|
||||
# DNS
|
||||
NAMESERVER1='213.73.91.35'
|
||||
NAMESERVER2='85.214.20.141'
|
||||
|
||||
enable_eatmydata_override() {
|
||||
chroot $rootdir apt-get install --no-install-recommends -y eatmydata
|
||||
if [ -x $rootdir/usr/bin/eatmydata ] && \
|
||||
|
@ -78,9 +94,9 @@ export LC_ALL=C LANGUAGE=C LANG=C
|
|||
# are not created yet.
|
||||
export TMP=/tmp/ TMPDIR=/tmp/
|
||||
|
||||
username=freedom
|
||||
username=$MY_USERNAME
|
||||
echo "warning: creating initial user $username with well known password!"
|
||||
password=bone
|
||||
password=$MY_PASSWORD
|
||||
chroot $rootdir adduser --gecos $username --disabled-password $username
|
||||
echo $username:$password | chroot $rootdir /usr/sbin/chpasswd
|
||||
chroot $rootdir adduser $username sudo
|
||||
|
@ -112,7 +128,7 @@ if [ -n "$CUSTOM_SETUP" ]; then
|
|||
chroot "$rootdir" gdebi -n /tmp/"$(basename $CUSTOM_SETUP)"
|
||||
fi
|
||||
|
||||
chroot "$rootdir" apt-get install -y git dialog
|
||||
chroot "$rootdir" apt-get install -y git dialog build-essential
|
||||
chroot "$rootdir" git clone https://github.com/bashrc/freedombone /root/freedombone
|
||||
chroot "$rootdir" cd /root/freedombone && make install
|
||||
|
||||
|
@ -127,18 +143,76 @@ chroot $rootdir /usr/lib/freedombone/setup 2>&1 | \
|
|||
# Remove SSH keys from the image
|
||||
rm $rootdir/etc/ssh/ssh_host_* || true
|
||||
|
||||
echo "# This file describes the network interfaces available on your system
|
||||
# and how to activate them. For more information, see interfaces(5).
|
||||
|
||||
# The loopback network interface
|
||||
auto lo
|
||||
iface lo inet loopback
|
||||
|
||||
# The primary network interface
|
||||
auto eth0
|
||||
iface eth0 inet static
|
||||
address $BOX_IP_ADDRESS
|
||||
netmask 255.255.255.0
|
||||
gateway $ROUTER_IP_ADDRESS
|
||||
dns-nameservers $NAMESERVER1 $NAMESERVER2
|
||||
# Example to keep MAC address between reboots
|
||||
#hwaddress ether B5:A2:BE:3F:1A:FE
|
||||
|
||||
# The secondary network interface
|
||||
#auto eth1
|
||||
#iface eth1 inet dhcp
|
||||
|
||||
# WiFi Example
|
||||
#auto wlan0
|
||||
#iface wlan0 inet dhcp
|
||||
# wpa-ssid \"essid\"
|
||||
# wpa-psk \"password\"
|
||||
|
||||
# Ethernet/RNDIS gadget (g_ether)
|
||||
# ... or on host side, usbnet and random hwaddr
|
||||
# Note on some boards, usb0 is automaticly setup with an init script
|
||||
#iface usb0 inet static
|
||||
# address 192.168.7.2
|
||||
# netmask 255.255.255.0
|
||||
# network 192.168.7.0
|
||||
# gateway 192.168.7.1" > $rootdir/etc/network/interfaces
|
||||
|
||||
hexarray=( 1 2 3 4 5 6 7 8 9 0 a b c d e f )
|
||||
a=${hexarray[$RANDOM%16]}${hexarray[$RANDOM%16]}
|
||||
b=${hexarray[$RANDOM%16]}${hexarray[$RANDOM%16]}
|
||||
c=${hexarray[$RANDOM%16]}${hexarray[$RANDOM%16]}
|
||||
d=${hexarray[$RANDOM%16]}${hexarray[$RANDOM%16]}
|
||||
e=${hexarray[$RANDOM%16]}${hexarray[$RANDOM%16]}
|
||||
sed -i "s|#hwaddress ether.*|hwaddress ether de:$a:$b:$c:$d:$e|g" $rootdir/etc/network/interfaces
|
||||
|
||||
sed -i "s/nameserver.*/nameserver $NAMESERVER1/g" $rootdir/etc/resolv.conf
|
||||
sed -i "/nameserver $NAMESERVER1/a\nameserver $NAMESERVER2" $rootdir/etc/resolv.conf
|
||||
|
||||
# change the motd to show further install instructions
|
||||
echo "
|
||||
To complete the installation run the following:
|
||||
|
||||
su
|
||||
freedombone menuconfig
|
||||
|
||||
" > $rootdir/etc/init.d/motd
|
||||
|
||||
|
||||
# copy u-boot to beginning of image
|
||||
case "$MACHINE" in
|
||||
beaglebone)
|
||||
chroot $rootdir apt-get -y install rng-tools
|
||||
sed -i 's|#HRNGDEVICE=/dev/hwrng|HRNGDEVICE=/dev/hwrng|g' $rootdir/etc/default/rng-tools
|
||||
chroot $rootdir apt-get -y install rng-tools
|
||||
sed -i 's|#HRNGDEVICE=/dev/hwrng|HRNGDEVICE=/dev/hwrng|g' $rootdir/etc/default/rng-tools
|
||||
|
||||
dd if=$rootdir/usr/lib/u-boot/am335x_boneblack/MLO of="$image" \
|
||||
count=1 seek=1 conv=notrunc bs=128k
|
||||
dd if=$rootdir/usr/lib/u-boot/am335x_boneblack/u-boot.img of="$image" \
|
||||
count=2 seek=1 conv=notrunc bs=384k
|
||||
;;
|
||||
dd if=$rootdir/usr/lib/u-boot/am335x_boneblack/MLO of="$image" \
|
||||
count=1 seek=1 conv=notrunc bs=128k
|
||||
dd if=$rootdir/usr/lib/u-boot/am335x_boneblack/u-boot.img of="$image" \
|
||||
count=2 seek=1 conv=notrunc bs=384k
|
||||
;;
|
||||
cubieboard2)
|
||||
chroot $rootdir apt-get -y install haveged
|
||||
dd if=$rootdir/usr/lib/u-boot/Cubieboard2/u-boot-sunxi-with-spl.bin of="$image" \
|
||||
seek=8 conv=notrunc bs=1k
|
||||
;;
|
||||
|
|
|
@ -25,6 +25,12 @@ export ARCHITECTURE
|
|||
export MACHINE
|
||||
export SOURCE
|
||||
export SUITE
|
||||
export MY_USERNAME
|
||||
export MY_PASSWORD
|
||||
export ROUTER_IP_ADDRESS
|
||||
export BOX_IP_ADDRESS
|
||||
export NAMESERVER1
|
||||
export NAMESERVER2
|
||||
|
||||
# Locate vmdebootstrap program fetched in Makefile
|
||||
basedir=`pwd`
|
||||
|
@ -103,6 +109,16 @@ else
|
|||
VMDEBOOTSTRAP=vmdebootstrap
|
||||
fi
|
||||
|
||||
echo 'Making customised customisation script'
|
||||
TEMP_CUSTOMISE=/etc/freedombone/image-customise
|
||||
sudo cp /usr/local/bin/freedombone-image-customise $TEMP_CUSTOMISE
|
||||
sudo sed -i "s|MY_USERNAME=.*|MY_USERNAME=${MY_USERNAME}|g" $TEMP_CUSTOMISE
|
||||
sudo sed -i "s|MY_PASSWORD=.*|MY_PASSWORD=${MY_PASSWORD}|g" $TEMP_CUSTOMISE
|
||||
sudo sed -i "s|ROUTER_IP_ADDRESS=.*|ROUTER_IP_ADDRESS=${ROUTER_IP_ADDRESS}|g" $TEMP_CUSTOMISE
|
||||
sudo sed -i "s|BOX_IP_ADDRESS=.*|BOX_IP_ADDRESS=${BOX_IP_ADDRESS}|g" $TEMP_CUSTOMISE
|
||||
sudo sed -i "s|NAMESERVER1=.*|NAMESERVER1=${NAMESERVER1}|g" $TEMP_CUSTOMISE
|
||||
sudo sed -i "s|NAMESERVER2=.*|NAMESERVER2=${NAMESERVER1}|g" $TEMP_CUSTOMISE
|
||||
|
||||
echo "starting $VMDEBOOTSTRAP"
|
||||
# Run vmdebootstrap script to create image
|
||||
sudo -H \
|
||||
|
@ -121,9 +137,12 @@ sudo -H \
|
|||
--hostname freedombone \
|
||||
--verbose \
|
||||
--mirror $BUILD_MIRROR \
|
||||
--customize "freedombone-image-customise" \
|
||||
--customize "$TEMP_CUSTOMISE" \
|
||||
--lock-root-password \
|
||||
--arch $ARCHITECTURE \
|
||||
--distribution $SUITE \
|
||||
$extra_opts \
|
||||
$pkgopts
|
||||
|
||||
echo 'Removing customised customisation script'
|
||||
sudo shred -zu $TEMP_CUSTOMISE
|
||||
|
|
|
@ -38,13 +38,32 @@ SIGN = -gpg --output $(SIGNATURE) --detach-sig $(ARCHIVE)
|
|||
TEST_SSH_PORT = 2222
|
||||
TEST_FIRSTRUN_WAIT_TIME = 120 # seconds
|
||||
|
||||
USERNAME ?= $(echo $USER)
|
||||
PASSWORD ?= 'freedombone'
|
||||
|
||||
# IP address of the router (gateway)
|
||||
ROUTER_IP_ADDRESS ?= "192.168.1.254"
|
||||
|
||||
# The fixed IP address of the Beaglebone Black (or other SBC) on your local network
|
||||
BOX_IP_ADDRESS ?= "192.168.1.55"
|
||||
|
||||
# DNS
|
||||
NAMESERVER1 ?= '213.73.91.35'
|
||||
NAMESERVER2 ?= '85.214.20.141'
|
||||
|
||||
# Using taskset to pin build process to single core. This is a
|
||||
# workaround for a qemu-user-static issue that causes builds to
|
||||
# hang. (See Debian bug #769983 for details.)
|
||||
MAKE_IMAGE = ARCHITECTURE=$(ARCHITECTURE) MACHINE=$(MACHINE) SOURCE=$(SOURCE) \
|
||||
MIRROR=$(MIRROR) SUITE=$(SUITE) OWNER=$(OWNER) \
|
||||
BUILD_MIRROR=$(BUILD_MIRROR) \
|
||||
CUSTOM_PLINTH=$(CUSTOM_PLINTH) CUSTOM_SETUP=$(CUSTOM_SETUP) \
|
||||
MY_USERNAME=$(USERNAME) \
|
||||
MY_PASSWORD=$(PASSWORD) \
|
||||
ROUTER_IP_ADDRESS=$(ROUTER_IP_ADDRESS) \
|
||||
BOX_IP_ADDRESS=$(BOX_IP_ADDRESS) \
|
||||
NAMESERVER1=$(NAMESERVER1) \
|
||||
NAMESERVER2=$(NAMESERVER2) \
|
||||
CUSTOM_SETUP=$(CUSTOM_SETUP) \
|
||||
IMAGE_SIZE=$(IMAGE_SIZE) taskset 0x01 freedombone-image-make $(NAME)
|
||||
|
||||
# build Beaglebone SD card image
|
||||
|
|
|
@ -58,9 +58,12 @@ DEBIAN_FILE_NAME="bone-debian-8.1-console-armhf-2015-07-12-2gb.img"
|
|||
DOWNLOAD_LINK1="https://rcn-ee.com/rootfs/bb.org/testing/2015-07-12/console/$DEBIAN_FILE_NAME.xz"
|
||||
|
||||
ROOTFS='rootfs'
|
||||
ROOTFS_SUBDIR=''
|
||||
|
||||
PARTITION_NUMBER=1
|
||||
|
||||
CURR_DIR=$(pwd)
|
||||
|
||||
function show_help {
|
||||
echo ''
|
||||
echo 'freedombone-prep -d [microSD device] --ip [BBB LAN IP address] --iprouter [Router LAN IP address] --mount [mount directory]'
|
||||
|
@ -83,7 +86,8 @@ if [ -d /media ]; then
|
|||
fi
|
||||
if [ -d /media/usb1/@ ]; then
|
||||
MICROSD_MOUNT_POINT=/media
|
||||
ROOTFS='usb1/@'
|
||||
ROOTFS=usb1
|
||||
ROOTFS_SUBDIR='/@'
|
||||
fi
|
||||
if [ -d /media/usb0 ]; then
|
||||
MICROSD_MOUNT_POINT=/media
|
||||
|
@ -114,7 +118,7 @@ case $key in
|
|||
-i|--image)
|
||||
shift
|
||||
DEBIAN_IMAGE_FILENAME="$1"
|
||||
ROOTFS='usb1/@'
|
||||
ROOTFS_SUBDIR='/@'
|
||||
;;
|
||||
# BBB static IP address on the LAN
|
||||
--ip)
|
||||
|
@ -177,7 +181,7 @@ SUDO=
|
|||
if [ -f /usr/bin/sudo ]; then
|
||||
SUDO='sudo'
|
||||
fi
|
||||
$SUDO apt-get install p7zip dd wget
|
||||
$SUDO apt-get install p7zip wget
|
||||
|
||||
if [ ! -d ~/freedombone ]; then
|
||||
mkdir ~/freedombone
|
||||
|
@ -198,6 +202,11 @@ if [ $DEBIAN_IMAGE_FILENAME ]; then
|
|||
exit 62394
|
||||
fi
|
||||
DEBIAN_FILE_NAME=$DEBIAN_IMAGE_FILENAME
|
||||
if [ ! -f ~/freedombone/$DEBIAN_FILE_NAME ]; then
|
||||
cd $CURR_DIR
|
||||
cp $DEBIAN_FILE_NAME ~/freedombone/$DEBIAN_FILE_NAME
|
||||
cd ~/freedombone
|
||||
fi
|
||||
else
|
||||
# default debian image downloaded from elsewhere
|
||||
if [ ! -f ~/freedombone/$DEBIAN_FILE_NAME.xz ]; then
|
||||
|
@ -215,7 +224,7 @@ fi
|
|||
|
||||
cd ~/freedombone
|
||||
echo 'Flashing image. This may take a while.'
|
||||
$SUDO dd if=$DEBIAN_FILE_NAME of=$MICROSD_DRIVE
|
||||
#$SUDO dd if=$DEBIAN_FILE_NAME of=$MICROSD_DRIVE
|
||||
sync
|
||||
|
||||
sleep 5
|
||||
|
@ -244,19 +253,19 @@ if [ ! -d $MICROSD_MOUNT_POINT/$ROOTFS ]; then
|
|||
exit 65688
|
||||
fi
|
||||
|
||||
if [ ! -d $MICROSD_MOUNT_POINT/$ROOTFS/home ]; then
|
||||
if [ ! -d $MICROSD_MOUNT_POINT/$ROOTFS$ROOTFS_SUBDIR/home ]; then
|
||||
echo ''
|
||||
echo "The rootfs partition was not written correctly."
|
||||
ls $MICROSD_MOUNT_POINT/$ROOTFS
|
||||
ls $MICROSD_MOUNT_POINT/$ROOTFS$ROOTFS_SUBDIR
|
||||
exit 65688
|
||||
fi
|
||||
|
||||
$SUDO sed -i 's/iface eth0 inet dhcp/iface eth0 inet static/g' $MICROSD_MOUNT_POINT/$ROOTFS/etc/network/interfaces
|
||||
$SUDO sed -i "/iface eth0 inet static/a\ dns-nameservers $NAMESERVER1 $NAMESERVER2" $MICROSD_MOUNT_POINT/$ROOTFS/etc/network/interfaces
|
||||
$SUDO sed -i "/iface eth0 inet static/a\ gateway $ROUTER_IP_ADDRESS" $MICROSD_MOUNT_POINT/$ROOTFS/etc/network/interfaces
|
||||
$SUDO sed -i '/iface eth0 inet static/a\ netmask 255.255.255.0' $MICROSD_MOUNT_POINT/$ROOTFS/etc/network/interfaces
|
||||
$SUDO sed -i "/iface eth0 inet static/a\ address $BBB_FIXED_IP_ADDRESS" $MICROSD_MOUNT_POINT/$ROOTFS/etc/network/interfaces
|
||||
$SUDO sed -i '/iface usb0 inet static/,/ gateway 192.168.7.1/ s/^/#/' $MICROSD_MOUNT_POINT/$ROOTFS/etc/network/interfaces
|
||||
$SUDO sed -i 's/iface eth0 inet dhcp/iface eth0 inet static/g' $MICROSD_MOUNT_POINT/$ROOTFS$ROOTFS_SUBDIR/etc/network/interfaces
|
||||
$SUDO sed -i "/iface eth0 inet static/a\ dns-nameservers $NAMESERVER1 $NAMESERVER2" $MICROSD_MOUNT_POINT/$ROOTFS$ROOTFS_SUBDIR/etc/network/interfaces
|
||||
$SUDO sed -i "/iface eth0 inet static/a\ gateway $ROUTER_IP_ADDRESS" $MICROSD_MOUNT_POINT/$ROOTFS$ROOTFS_SUBDIR/etc/network/interfaces
|
||||
$SUDO sed -i '/iface eth0 inet static/a\ netmask 255.255.255.0' $MICROSD_MOUNT_POINT/$ROOTFS$ROOTFS_SUBDIR/etc/network/interfaces
|
||||
$SUDO sed -i "/iface eth0 inet static/a\ address $BBB_FIXED_IP_ADDRESS" $MICROSD_MOUNT_POINT/$ROOTFS$ROOTFS_SUBDIR/etc/network/interfaces
|
||||
$SUDO sed -i '/iface usb0 inet static/,/ gateway 192.168.7.1/ s/^/#/' $MICROSD_MOUNT_POINT/$ROOTFS$ROOTFS_SUBDIR/etc/network/interfaces
|
||||
|
||||
hexarray=( 1 2 3 4 5 6 7 8 9 0 a b c d e f )
|
||||
a=${hexarray[$RANDOM%16]}${hexarray[$RANDOM%16]}
|
||||
|
@ -264,24 +273,24 @@ b=${hexarray[$RANDOM%16]}${hexarray[$RANDOM%16]}
|
|||
c=${hexarray[$RANDOM%16]}${hexarray[$RANDOM%16]}
|
||||
d=${hexarray[$RANDOM%16]}${hexarray[$RANDOM%16]}
|
||||
e=${hexarray[$RANDOM%16]}${hexarray[$RANDOM%16]}
|
||||
$SUDO sed -i "s|#hwaddress ether.*|hwaddress ether de:$a:$b:$c:$d:$e|g" $MICROSD_MOUNT_POINT/$ROOTFS/etc/network/interfaces
|
||||
$SUDO sed -i "s|#hwaddress ether.*|hwaddress ether de:$a:$b:$c:$d:$e|g" $MICROSD_MOUNT_POINT/$ROOTFS$ROOTFS_SUBDIR/etc/network/interfaces
|
||||
|
||||
$SUDO sed -i "s/nameserver.*/nameserver $NAMESERVER1/g" $MICROSD_MOUNT_POINT/$ROOTFS/etc/resolv.conf
|
||||
$SUDO sed -i "/nameserver $NAMESERVER1/a\nameserver $NAMESERVER2" $MICROSD_MOUNT_POINT/$ROOTFS/etc/resolv.conf
|
||||
$SUDO sed -i "s/nameserver.*/nameserver $NAMESERVER1/g" $MICROSD_MOUNT_POINT/$ROOTFS$ROOTFS_SUBDIR/etc/resolv.conf
|
||||
$SUDO sed -i "/nameserver $NAMESERVER1/a\nameserver $NAMESERVER2" $MICROSD_MOUNT_POINT/$ROOTFS$ROOTFS_SUBDIR/etc/resolv.conf
|
||||
|
||||
# copy the commands to the card
|
||||
$SUDO cp -f $(which freedombone)* $MICROSD_MOUNT_POINT/$ROOTFS/usr/local/bin/
|
||||
$SUDO cp -f $(which zeronetavahi)* $MICROSD_MOUNT_POINT/$ROOTFS/usr/local/bin/
|
||||
$SUDO cp -f $MICROSD_MOUNT_POINT/$ROOTFS/usr/local/bin/freedombone-mesh $MICROSD_MOUNT_POINT/$ROOTFS/usr/local/bin/mesh
|
||||
$SUDO cp -f $MICROSD_MOUNT_POINT/$ROOTFS/usr/local/bin/freedombone-meshweb $MICROSD_MOUNT_POINT/$ROOTFS/usr/local/bin/meshweb
|
||||
if [ ! -f $MICROSD_MOUNT_POINT/$ROOTFS/usr/local/bin/freedombone ]; then
|
||||
$SUDO cp -f $(which freedombone)* $MICROSD_MOUNT_POINT/$ROOTFS$ROOTFS_SUBDIR/usr/local/bin/
|
||||
$SUDO cp -f $(which zeronetavahi)* $MICROSD_MOUNT_POINT/$ROOTFS$ROOTFS_SUBDIR/usr/local/bin/
|
||||
$SUDO cp -f $MICROSD_MOUNT_POINT/$ROOTFS$ROOTFS_SUBDIR/usr/local/bin/freedombone-mesh $MICROSD_MOUNT_POINT/$ROOTFS$ROOTFS_SUBDIR/usr/local/bin/mesh
|
||||
$SUDO cp -f $MICROSD_MOUNT_POINT/$ROOTFS$ROOTFS_SUBDIR/usr/local/bin/freedombone-meshweb $MICROSD_MOUNT_POINT/$ROOTFS$ROOTFS_SUBDIR/usr/local/bin/meshweb
|
||||
if [ ! -f $MICROSD_MOUNT_POINT/$ROOTFS$ROOTFS_SUBDIR/usr/local/bin/freedombone ]; then
|
||||
echo 'There was a problem with writing freedombone commands to the SD card'
|
||||
exit 8736
|
||||
fi
|
||||
|
||||
# remove automatic motd creator if it exists
|
||||
if [ -f $MICROSD_MOUNT_POINT/$ROOTFS/etc/init.d/motd ]; then
|
||||
$SUDO rm -f $MICROSD_MOUNT_POINT/$ROOTFS/etc/init.d/motd
|
||||
if [ -f $MICROSD_MOUNT_POINT/$ROOTFS$ROOTFS_SUBDIR/etc/init.d/motd ]; then
|
||||
$SUDO rm -f $MICROSD_MOUNT_POINT/$ROOTFS$ROOTFS_SUBDIR/etc/init.d/motd
|
||||
fi
|
||||
|
||||
# change the motd to show further install instructions
|
||||
|
@ -303,7 +312,7 @@ echo ' apt-get update' >> /tmp/freedombone_motd
|
|||
echo ' apt-get -y install git dialog build-essential' >> /tmp/freedombone_motd
|
||||
echo ' freedombone menuconfig' >> /tmp/freedombone_motd
|
||||
|
||||
$SUDO cp -f /tmp/freedombone_motd $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
|
||||
$SUDO cp -f /tmp/freedombone_motd $MICROSD_MOUNT_POINT/$ROOTFS$ROOTFS_SUBDIR/etc/motd
|
||||
|
||||
clear
|
||||
echo '*** Initial microSD card setup is complete ***'
|
||||
|
|
Loading…
Reference in New Issue