Different directories for Debian
This commit is contained in:
parent
59377b4151
commit
ef73e6450b
|
@ -44,6 +44,9 @@ DEBIAN_FILE_NAME="debian-jessie-console-armhf-2014-08-13"
|
|||
DOWNLOAD_LINK1="https://rcn-ee.net/deb/rootfs/jessie/$DEBIAN_FILE_NAME.tar.xz"
|
||||
DOWNLOAD_LINK2="http://ynezz.ibawizard.net/beagleboard/jessie/$DEBIAN_FILE_NAME.tar.xz"
|
||||
|
||||
ROOTFS='rootfs'
|
||||
BOOT='BOOT'
|
||||
|
||||
function show_help {
|
||||
echo ''
|
||||
echo 'freedombone-prep -d [microSD device] --ip [BBB LAN IP address] --iprouter [Router LAN IP address] --mount [mount directory]'
|
||||
|
@ -59,9 +62,24 @@ if [[ $NO_OF_ARGS == 0 ]]; then
|
|||
fi
|
||||
|
||||
if [ ! -d $MICROSD_MOUNT_POINT ]; then
|
||||
echo "The mount directory $MICROSD_MOUNT_POINT does not exist."
|
||||
echo 'Use the --mount option to specify where the microSD gets mounted to.'
|
||||
exit 67563
|
||||
if [ -d /media ]; then
|
||||
if [ ! -d /media/$ROOTFS ]; then
|
||||
# different directories for Debian
|
||||
if [ -d /media/usb1/home ]; then
|
||||
MICROSD_MOUNT_POINT=/media
|
||||
ROOTFS=usb1
|
||||
fi
|
||||
if [ -f /media/usb0/bbb-uEnv.txt ]; then
|
||||
MICROSD_MOUNT_POINT=/media
|
||||
BOOT=usb0
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
if [ ! -d $MICROSD_MOUNT_POINT ]; then
|
||||
echo "The mount directory $MICROSD_MOUNT_POINT does not exist."
|
||||
echo 'Use the --mount option to specify where the microSD gets mounted to.'
|
||||
exit 67563
|
||||
fi
|
||||
fi
|
||||
|
||||
while [[ $# > 1 ]]
|
||||
|
@ -160,60 +178,60 @@ if [ ! -b ${MICROSD_DRIVE}1 ]; then
|
|||
fi
|
||||
fi
|
||||
|
||||
if [ ! -d $MICROSD_MOUNT_POINT/BOOT ]; then
|
||||
echo "The boot partition $MICROSD_MOUNT_POINT/BOOT was not found."
|
||||
if [ ! -d $MICROSD_MOUNT_POINT/$BOOT ]; then
|
||||
echo "The boot partition $MICROSD_MOUNT_POINT/$BOOT was not found."
|
||||
ls $MICROSD_MOUNT_POINT
|
||||
exit 67857
|
||||
fi
|
||||
|
||||
if [ ! -d $MICROSD_MOUNT_POINT/rootfs ]; then
|
||||
echo "The rootfs partition $MICROSD_MOUNT_POINT/rootfs was not found."
|
||||
if [ ! -d $MICROSD_MOUNT_POINT/$ROOTFS ]; then
|
||||
echo "The rootfs partition $MICROSD_MOUNT_POINT/$ROOTFS was not found."
|
||||
ls $MICROSD_MOUNT_POINT
|
||||
exit 65688
|
||||
fi
|
||||
|
||||
$SUDO cp $MICROSD_MOUNT_POINT/BOOT/bbb-uEnv.txt $MICROSD_MOUNT_POINT/BOOT/uEnv.txt
|
||||
$SUDO cp $MICROSD_MOUNT_POINT/$BOOT/bbb-uEnv.txt $MICROSD_MOUNT_POINT/$BOOT/uEnv.txt
|
||||
|
||||
$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 213.73.91.35 85.214.20.141' $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/etc/network/interfaces
|
||||
$SUDO sed -i '/iface eth0 inet static/a\ dns-nameservers 213.73.91.35 85.214.20.141' $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/nameserver.*/nameserver 213.73.91.35/g' $MICROSD_MOUNT_POINT/rootfs/etc/resolv.conf
|
||||
$SUDO sed -i '/nameserver 213.73.91.35/a\nameserver 85.214.20.141' $MICROSD_MOUNT_POINT/rootfs/etc/resolv.conf
|
||||
$SUDO sed -i 's/nameserver.*/nameserver 213.73.91.35/g' $MICROSD_MOUNT_POINT/$ROOTFS/etc/resolv.conf
|
||||
$SUDO sed -i '/nameserver 213.73.91.35/a\nameserver 85.214.20.141' $MICROSD_MOUNT_POINT/$ROOTFS/etc/resolv.conf
|
||||
|
||||
# change the motd to show further install instructions
|
||||
echo 'Become the root user by typing:' > $MICROSD_MOUNT_POINT/rootfs/etc/motd
|
||||
echo '' >> $MICROSD_MOUNT_POINT/rootfs/etc/motd
|
||||
echo ' su' >> $MICROSD_MOUNT_POINT/rootfs/etc/motd
|
||||
echo '' >> $MICROSD_MOUNT_POINT/rootfs/etc/motd
|
||||
echo 'Using the password "root". Change the root user password by typing:' >> $MICROSD_MOUNT_POINT/rootfs/etc/motd
|
||||
echo '' >> $MICROSD_MOUNT_POINT/rootfs/etc/motd
|
||||
echo ' passwd' >> $MICROSD_MOUNT_POINT/rootfs/etc/motd
|
||||
echo '' >> $MICROSD_MOUNT_POINT/rootfs/etc/motd
|
||||
echo 'Then create a user for the system with:' >> $MICROSD_MOUNT_POINT/rootfs/etc/motd
|
||||
echo '' >> $MICROSD_MOUNT_POINT/rootfs/etc/motd
|
||||
echo ' adduser [username]' >> $MICROSD_MOUNT_POINT/rootfs/etc/motd
|
||||
echo '' >> $MICROSD_MOUNT_POINT/rootfs/etc/motd
|
||||
echo 'Enter the command "exit" a couple of times to get back to your main system' >> $MICROSD_MOUNT_POINT/rootfs/etc/motd
|
||||
echo 'then log back in as the user you just created with:' >> $MICROSD_MOUNT_POINT/rootfs/etc/motd
|
||||
echo '' >> $MICROSD_MOUNT_POINT/rootfs/etc/motd
|
||||
echo ' ssh [username]@$BBB_FIXED_IP_ADDRESS' >> $MICROSD_MOUNT_POINT/rootfs/etc/motd
|
||||
echo '' >> $MICROSD_MOUNT_POINT/rootfs/etc/motd
|
||||
echo 'and use the "su" command to become the root user again. You can then load' >> $MICROSD_MOUNT_POINT/rootfs/etc/motd
|
||||
echo 'the freedombone main installation script with:' >> $MICROSD_MOUNT_POINT/rootfs/etc/motd
|
||||
echo '' >> $MICROSD_MOUNT_POINT/rootfs/etc/motd
|
||||
echo ' apt-get update' >> $MICROSD_MOUNT_POINT/rootfs/etc/motd
|
||||
echo ' apt-get -y install git dialog build-essential' >> $MICROSD_MOUNT_POINT/rootfs/etc/motd
|
||||
echo ' git clone https://github.com/bashrc/freedombone.git' >> $MICROSD_MOUNT_POINT/rootfs/etc/motd
|
||||
echo ' cd freedombone' >> $MICROSD_MOUNT_POINT/rootfs/etc/motd
|
||||
echo ' make install' >> $MICROSD_MOUNT_POINT/rootfs/etc/motd
|
||||
echo '' >> $MICROSD_MOUNT_POINT/rootfs/etc/motd
|
||||
echo 'Finally you can use the freedombone command to install a server configuration:' >> $MICROSD_MOUNT_POINT/rootfs/etc/motd
|
||||
echo '' >> $MICROSD_MOUNT_POINT/rootfs/etc/motd
|
||||
echo ' freedombone menuconfig' >> $MICROSD_MOUNT_POINT/rootfs/etc/motd
|
||||
echo 'Become the root user by typing:' > $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
|
||||
echo '' >> $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
|
||||
echo ' su' >> $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
|
||||
echo '' >> $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
|
||||
echo 'Using the password "root". Change the root user password by typing:' >> $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
|
||||
echo '' >> $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
|
||||
echo ' passwd' >> $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
|
||||
echo '' >> $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
|
||||
echo 'Then create a user for the system with:' >> $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
|
||||
echo '' >> $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
|
||||
echo ' adduser [username]' >> $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
|
||||
echo '' >> $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
|
||||
echo 'Enter the command "exit" a couple of times to get back to your main system' >> $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
|
||||
echo 'then log back in as the user you just created with:' >> $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
|
||||
echo '' >> $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
|
||||
echo ' ssh [username]@$BBB_FIXED_IP_ADDRESS' >> $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
|
||||
echo '' >> $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
|
||||
echo 'and use the "su" command to become the root user again. You can then load' >> $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
|
||||
echo 'the freedombone main installation script with:' >> $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
|
||||
echo '' >> $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
|
||||
echo ' apt-get update' >> $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
|
||||
echo ' apt-get -y install git dialog build-essential' >> $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
|
||||
echo ' git clone https://github.com/bashrc/freedombone.git' >> $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
|
||||
echo ' cd freedombone' >> $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
|
||||
echo ' make install' >> $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
|
||||
echo '' >> $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
|
||||
echo 'Finally you can use the freedombone command to install a server configuration:' >> $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
|
||||
echo '' >> $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
|
||||
echo ' freedombone menuconfig' >> $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
|
||||
|
||||
clear
|
||||
echo '*** Initial microSD card setup is complete ***'
|
||||
|
@ -224,5 +242,5 @@ echo ''
|
|||
echo " ssh debian@$BBB_FIXED_IP_ADDRESS"
|
||||
echo ''
|
||||
echo 'The password is "temppwd".'
|
||||
cat $MICROSD_MOUNT_POINT/rootfs/etc/motd
|
||||
cat $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd
|
||||
exit 0
|
||||
|
|
Loading…
Reference in New Issue