mirror of
https://github.com/CopterExpress/clover.git
synced 2026-05-27 05:29:32 +00:00
image_builder: edit to HW setup at init script
This commit is contained in:
@@ -9,24 +9,27 @@ echo ':arm:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x2
|
||||
|
||||
apt install unzip wget
|
||||
|
||||
BUILD_DIR=$(pwd)
|
||||
|
||||
set -e
|
||||
|
||||
RPI_DONWLOAD_URL="https://downloads.raspberrypi.org/raspbian_lite/images/raspbian_lite-2017-12-01/2017-11-29-raspbian-stretch-lite.zip"
|
||||
BUILD_DIR=$(pwd)
|
||||
IMAGE_NAME="clever_qemu.img"
|
||||
|
||||
RPI_DONWLOAD_URL="https://downloads.raspberrypi.org/raspbian_lite/images/raspbian_lite-2017-12-01/2017-11-29-raspbian-stretch-lite.zip"
|
||||
./image_config.sh get_image ${BUILD_DIR} ${RPI_DONWLOAD_URL} ${IMAGE_NAME}
|
||||
|
||||
./image_config.sh resize_fs ${BUILD_DIR}/${IMAGE_NAME} 7G
|
||||
|
||||
./image_config.sh copy_to_chroot ${BUILD_DIR}/${IMAGE_NAME} "qemu-arm-resin" "/usr/bin/qemu-arm-static"
|
||||
./image_config.sh copy_to_chroot ${BUILD_DIR}/${IMAGE_NAME} "kinetic-ros-coex.rosinstall" "/home/pi/ros_catkin_ws/"
|
||||
|
||||
./image_config.sh execute ${BUILD_DIR}/${IMAGE_NAME} scripts/change_boot_part.sh
|
||||
./image_config.sh execute ${BUILD_DIR}/${IMAGE_NAME} scripts/init_image.sh qemu_build_17082018 raspbian_nov_2017
|
||||
#./image_config.sh execute ${BUILD_DIR}/${IMAGE_NAME} scripts/change_boot_part.sh
|
||||
./image_config.sh execute ${BUILD_DIR}/${IMAGE_NAME} scripts/init_image.sh qemu_build_20082018 raspbian_nov_2017
|
||||
./image_config.sh execute ${BUILD_DIR}/${IMAGE_NAME} scripts/software_install.sh
|
||||
./image_config.sh execute ${BUILD_DIR}/${IMAGE_NAME} scripts/network_setup.sh
|
||||
./image_config.sh execute ${BUILD_DIR}/${IMAGE_NAME} scripts/ros_install.sh https://github.com/CopterExpress/clever.git master True
|
||||
|
||||
#./image_config.sh copy_to_chroot ${BUILD_DIR}/${IMAGE_NAME} "kinetic-ros-coex.rosinstall" "/home/pi/ros_catkin_ws/"
|
||||
#./image_config.sh execute ${BUILD_DIR}/${IMAGE_NAME} scripts/ros_install.sh https://github.com/CopterExpress/clever.git master True
|
||||
|
||||
./image_config.sh copy_to_chroot ${BUILD_DIR}/${IMAGE_NAME} "scripts/init_rpi.sh" "/root/"
|
||||
./image_config.sh copy_to_chroot ${BUILD_DIR}/${IMAGE_NAME} "scripts/hardware_setup.sh" "/root/"
|
||||
|
||||
#./image_config.sh copy_to_chroot ${BUILD_DIR}/${IMAGE_NAME} "scripts" "/"
|
||||
#./image_config.sh execute ${BUILD_DIR}/${IMAGE_NAME}
|
||||
#./image_config.sh execute ${BUILD_DIR}/${IMAGE_NAME}
|
||||
@@ -28,4 +28,8 @@ echo "$1" >> /etc/clever_version
|
||||
# Origin image file name
|
||||
echo "${2%.*}" >> /etc/clever_origin
|
||||
|
||||
echo -e "\033[0;31m\033[1m$(date) | #3 End initialisation of image\033[0m\033[0m"
|
||||
echo -e "\033[0;31m\033[1m$(date) | #1 Write magic script to /etc/rc.local\033[0m\033[0m"
|
||||
MAGIC_SCRIPT="sudo /root/init_rpi.sh && sudo sed -i '/sudo \/root\/init_rpi.sh/d' /etc/rc.local && sudo reboot"
|
||||
sed -i "19a${MAGIC_SCRIPT}" /etc/rc.local
|
||||
|
||||
echo -e "\033[0;31m\033[1m$(date) | #3 End initialisation of image\033[0m\033[0m"
|
||||
9
image_builder/scripts/init_rpi.sh
Executable file
9
image_builder/scripts/init_rpi.sh
Executable file
@@ -0,0 +1,9 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo -e "\033[0;31m\033[1m$(date) | #1 Rename SSID\033[0m\033[0m"
|
||||
sudo sed -i.OLD "s/CLEVER/CLEVER-$(head -c 100 /dev/urandom | xxd -ps -c 100 | sed -e 's/[^0-9]//g' | cut -c 1-4)/g" /etc/wpa_supplicant/wpa_supplicant.conf
|
||||
|
||||
echo -e "\033[0;31m\033[1m$(date) | #2 Harware setup\033[0m\033[0m"
|
||||
/root/hardware_setup.sh
|
||||
|
||||
echo -e "\033[0;31m\033[1m$(date) | #3 End of network installation\033[0m\033[0m"
|
||||
@@ -36,10 +36,8 @@ domain-needed
|
||||
quiet-dhcp6
|
||||
" >> /etc/dnsmasq.conf
|
||||
|
||||
echo -e "\033[0;31m\033[1m$(date) | #4 Write magic script for rename SSID to /etc/rc.local\033[0m\033[0m"
|
||||
|
||||
RENAME_SSID="sudo sed -i.OLD \"s/CLEVER/CLEVER-\$(head -c 100 /dev/urandom | xxd -ps -c 100 | sed -e 's/[^0-9]//g' | cut -c 1-4)/g\" /etc/wpa_supplicant/wpa_supplicant.conf && sudo sed -i '/sudo sed/d' /etc/rc.local && sudo reboot"
|
||||
|
||||
sed -i "19a$RENAME_SSID" /etc/rc.local
|
||||
#echo -e "\033[0;31m\033[1m$(date) | #4 Write magic script for rename SSID to /etc/rc.local\033[0m\033[0m"
|
||||
#RENAME_SSID="sudo sed -i.OLD \"s/CLEVER/CLEVER-\$(head -c 100 /dev/urandom | xxd -ps -c 100 | sed -e 's/[^0-9]//g' | cut -c 1-4)/g\" /etc/wpa_supplicant/wpa_supplicant.conf && sudo sed -i '/sudo sed/d' /etc/rc.local && sudo reboot"
|
||||
#sed -i "19a$RENAME_SSID" /etc/rc.local
|
||||
|
||||
echo -e "\033[0;31m\033[1m$(date) | #5 End of network installation\033[0m\033[0m"
|
||||
|
||||
Reference in New Issue
Block a user