This commit is contained in:
Alexander 2024-02-23 19:20:39 +01:00
parent b5372832e5
commit 3c5688012f
14 changed files with 67 additions and 226 deletions

View file

@ -22,14 +22,14 @@ if [ ! -d "$project_root" ]; then
fi
# check the target folder
target_folder="$project_root/unpacked/squashfs-root"
target_folder="$ROOTFS_DIR"
if [ ! -d "$target_folder" ]; then
echo -e "${RED}ERROR: Cannot find the target folder '$target_folder' ${NC}"
exit 4
fi
# try to find out the app version (like app_ver="309")
def_target="$project_root/unpacked/squashfs-root/app/app"
def_target="$ROOTFS_DIR/app/app"
app_ver=$("$app_version_tool" "$def_target")
if [ $? != 0 ]; then
echo -e "${RED}ERROR: Cannot find the app version ${NC}"
@ -44,7 +44,7 @@ if [ $? != 0 ]; then
fi
# find if the selected setting file exists
settings_file="$project_root/RESOURCES/OPTIONS/app_net_ready/$settings/${app_ver}.${app_model}"
settings_file="$OPTIONS_DIR/app_net_ready/$settings/${app_ver}.${app_model}"
if [ ! -f "$settings_file" ]; then
echo -e "${RED}ERROR: Unsupported model and version! Cannot find the settings file '$settings_file' ${NC}"
exit 7

View file

@ -1,10 +1,5 @@
#!/bin/bash
# global definitions:
RED='\033[0;31m'
GREEN='\033[0;32m'
NC='\033[0m'
# check the parameters
if [ $# != 2 ]; then
echo "usage : $0 <project_root> <banner_file>"
@ -17,15 +12,7 @@ banner_file="$2"
# Echo the banner into $project_root/unpacked/etc/banner
# Check the required tools
TOOL_LIST="cat"
for tool_name in $TOOL_LIST; do
echo "Checking tool: $tool_name"
tool_path=$(which "$tool_name")
if [ -z "$tool_path" ]; then
echo -e "${RED}ERROR: Missing tool '$tool_name' ${NC}"
exit 1
fi
done
check_tools "cat"
# Check the project root folder
if [ ! -d "$project_root" ]; then
@ -34,13 +21,13 @@ if [ ! -d "$project_root" ]; then
fi
# Check the banner exists
if [ ! -f "$project_root/RESOURCES/OPTIONS/$banner_file/$banner_file" ]; then
if [ ! -f "$OPTIONS_DIR/$banner_file/$banner_file" ]; then
echo -e "${RED}ERROR: Cannot find the file '$banner_file' ${NC}"
exit 3
fi
# Overwrite the banner file with ./banner if error then exit
cat "$project_root/RESOURCES/OPTIONS/$banner_file/$banner_file" >"$project_root/unpacked/squashfs-root/etc/banner"
cat "$OPTIONS_DIR/$banner_file/$banner_file" >"$ROOTFS_DIR/etc/banner"
if [ $? != 0 ]; then
echo -e "${RED}ERROR: Cannot overwrite the banner file ${NC}"
exit 4

View file

@ -1,11 +1,5 @@
#!/bin/bash
# global definitions:
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[0;33m'
NC='\033[0m'
# check the parameters
if [ $# != 2 ]; then
echo "usage : $0 <project_root>"
@ -15,15 +9,7 @@ fi
project_root="$1"
# check the required tools
TOOL_LIST="rm"
for tool_name in $TOOL_LIST; do
echo "Checking tool: $tool_name"
tool_path=$(which "$tool_name")
if [ -z "$tool_path" ]; then
echo -e "${RED}ERROR: Missing tool '$tool_name' ${NC}"
exit 1
fi
done
check_tools "rm"
# check the project root folder
if [ ! -d "$project_root" ]; then
@ -52,18 +38,18 @@ folders=(
# Remove the folders and files
# Check if folder or file and remove it
for folder in "${folders[@]}"; do
if [ -d "$project_root/unpacked/squashfs-root/$folder" ]; then
echo "Removing folder: $project_root/unpacked/squashfs-root/$folder"
rm -rf "$project_root/unpacked/squashfs-root/$folder"
if [ -d "$ROOTFS_DIR/$folder" ]; then
echo "Removing folder: $ROOTFS_DIR/$folder"
rm -rf "$ROOTFS_DIR/$folder"
if [ $? -ne 0 ]; then
echo -e "${RED}ERROR: Failed to remove folder: $project_root/unpacked/squashfs-root/$folder ${NC}"
echo -e "${RED}ERROR: Failed to remove folder: $ROOTFS_DIR/$folder ${NC}"
exit 3
fi
elif [ -f "$project_root/unpacked/squashfs-root/$folder" ]; then
echo "Removing file: $project_root/unpacked/squashfs-root/$folder"
rm -f "$project_root/unpacked/squashfs-root/$folder"
elif [ -f "$ROOTFS_DIR/$folder" ]; then
echo "Removing file: $ROOTFS_DIR/$folder"
rm -f "$ROOTFS_DIR/$folder"
if [ $? -ne 0 ]; then
echo -e "${RED}ERROR: Failed to remove file: $project_root/unpacked/squashfs-root/$folder ${NC}"
echo -e "${RED}ERROR: Failed to remove file: $ROOTFS_DIR/$folder ${NC}"
exit 3
fi
fi

View file

@ -1,10 +1,5 @@
#!/bin/bash
# global definitions:
RED='\033[0;31m'
GREEN='\033[0;32m'
NC='\033[0m'
# check the parameters
if [ $# != 2 ]; then
echo "usage : $0 <project_root> <boot_resource>"
@ -21,21 +16,21 @@ if [ ! -d "$project_root" ]; then
fi
# check the selected boot resource folder
boot_resource_folder="$project_root/RESOURCES/OPTIONS/boot_resource/$boot_resource"
boot_resource_folder="$OPTIONS_DIR/boot_resource/$boot_resource"
if [ ! -d "$boot_resource_folder" ]; then
echo -e "${RED}ERROR: Cannot find the folder '$boot_resource_folder' ${NC}"
exit 3
fi
# check the selected boot resource file
boot_resource_file="$project_root/RESOURCES/OPTIONS/boot_resource/$boot_resource/boot-resource"
boot_resource_file="$boot_resource_folder/boot-resource"
if [ ! -f "$boot_resource_file" ]; then
echo -e "${RED}ERROR: Cannot find the folder '$boot_resource_file'\nPlease use 'sudo ./process.sh' to create the 'boot_resource' file from the source folder ${NC}"
exit 3
fi
# check the target folder
target_folder="$project_root/unpacked"
target_folder="$ROOTFS_DIR"
if [ ! -d "$target_folder" ]; then
echo -e "${RED}ERROR: Cannot find the target folder '$target_folder' ${NC}"
exit 4

View file

@ -1,10 +1,5 @@
#!/bin/bash
# global definitions:
RED='\033[0;31m'
GREEN='\033[0;32m'
NC='\033[0m'
# check the parameters
if [ $# != 2 ]; then
echo "usage : $0 <project_root> <webcam_package>"
@ -22,28 +17,7 @@ if [ "$package_action" == "run" ]; then
auto_start="Y"
fi
# check the required tools
app_version_tool=$(which app_version.sh)
app_model_tool=$(which app_model.sh)
TOOL_LIST="unzip app_version.sh app_model.sh dd printf"
for tool_name in $TOOL_LIST; do
echo "Checking tool: $tool_name"
tool_path=$(which "$tool_name")
if [ -z "$tool_path" ]; then
local_tool_path="$project_root/TOOLS/$tool_name"
if [ ! -f "$local_tool_path" ]; then
echo -e "${RED}ERROR: Missing tool '$tool_name' ${NC}"
exit 2
else
if [ "$tool_name" == "app_version.sh" ]; then
app_version_tool="$local_tool_path"
fi
if [ "$tool_name" == "app_model.sh" ]; then
app_model_tool="$local_tool_path"
fi
fi
fi
done
check_tools "unzip app_version.sh app_model.sh dd printf"
# check the project root folder
if [ ! -d "$project_root" ]; then
@ -52,7 +26,7 @@ if [ ! -d "$project_root" ]; then
fi
# check the webcam package folder
webcam_package_folder="${project_root}/RESOURCES/OPTIONS/camera/${package_name}"
webcam_package_folder="$OPTIONS_DIR/camera/$package_name"
if [ ! -d "$webcam_package_folder" ]; then
echo -e "${RED}ERROR: Cannot find the folder '$webcam_package_folder' ${NC}"
exit 4
@ -66,7 +40,7 @@ if [ ! -f "$webcam_package_file" ]; then
fi
# check the target folder
target_folder="$project_root/unpacked/squashfs-root"
target_folder="$ROOTFS_DIR"
if [ ! -d "$target_folder" ]; then
echo -e "${RED}ERROR: Cannot find the target folder '$target_folder' ${NC}"
exit 6
@ -80,11 +54,11 @@ cd "$current_folder" || exit 8
if [ "$auto_start" == "N" ]; then
# auto start not requested, remove the auto start
rm -f "$project_root/unpacked/squashfs-root/opt/etc/init.d/S55camera"
rm -f "$ROOTFS_DIR/opt/etc/init.d/S55camera"
fi
# try to find out the app version (like app_ver="309")
def_target="$project_root/unpacked/squashfs-root/app/app"
def_target="$ROOTFS_DIR/app/app"
app_ver=$("$app_version_tool" "$def_target")
if [ $? != 0 ]; then
echo -e "${RED}ERROR: Cannot find the app version ${NC}"

View file

@ -1,10 +1,5 @@
#!/bin/bash
# global definitions:
RED='\033[0;31m'
GREEN='\033[0;32m'
NC='\033[0m'
# check the parameters
if [ $# != 2 ]; then
echo "usage : $0 <project_root> <public_key>"
@ -27,7 +22,7 @@ if [ ! -f "$public_key" ]; then
fi
# check the target folder
target_folder="$project_root/unpacked/squashfs-root/etc"
target_folder="$ROOTFS_DIR/etc"
if [ ! -d "$target_folder" ]; then
echo -e "${RED}ERROR: Cannot find the output folder '$target_folder' ${NC}"
exit 4

View file

@ -1,10 +1,5 @@
#!/bin/bash
# global definitions:
RED='\033[0;31m'
GREEN='\033[0;32m'
NC='\033[0m'
# check the parameters
if [ $# != 2 ]; then
echo "usage : $0 <project_root> <fswebcam_package>"
@ -14,16 +9,7 @@ fi
project_root="$1"
fswebcam_package="$2"
# check the required tools
TOOL_LIST="unzip sed"
for tool_name in $TOOL_LIST; do
echo "Checking tool: $tool_name"
tool_path=$(which "$tool_name")
if [ -z "$tool_path" ]; then
echo -e "${RED}ERROR: Missing tool '$tool_name' ${NC}"
exit 1
fi
done
check_tools "unzip sed"
# check the project root folder
if [ ! -d "$project_root" ]; then
@ -32,7 +18,7 @@ if [ ! -d "$project_root" ]; then
fi
# check the fswebcam package folder
fswebcam_package_folder="${project_root}/RESOURCES/OPTIONS/fswebcam/${fswebcam_package}"
fswebcam_package_folder="${OPTIONS_DIR}/fswebcam/${fswebcam_package}"
if [ ! -d "$fswebcam_package_folder" ]; then
echo -e "${RED}ERROR: Cannot find the folder '$fswebcam_package_folder' ${NC}"
exit 4
@ -46,7 +32,7 @@ if [ ! -f "$fswebcam_package_file" ]; then
fi
# check the target folder
target_folder="$project_root/unpacked/squashfs-root"
target_folder="$ROOTFS_DIR"
if [ ! -d "$target_folder" ]; then
echo -e "${RED}ERROR: Cannot find the target folder '$target_folder' ${NC}"
exit 6

View file

@ -1,32 +1,28 @@
#!/bin/bash
RED='\033[0;31m'
YELLOW='\033[1;33m'
GREEN='\033[0;32m'
NC='\033[0m'
# default urls to be replaced
mqtt_urls="mqtt-universe-test.anycubic.com mqtt-universe.anycubic.com mqtt-test.anycubic.com mqtt.anycubic.com"
project_root="$1"
# check the parameters
if [ $# != 2 ]; then
echo "usage : $0 <project_root> <mqtt_url>"
exit 1
fi
def_target="$1/unpacked/squashfs-root/app/app"
def_target="$ROOTFS_DIR/app/app"
def_url="$2"
# check the required tools
TOOL_LIST="printf dd grep awk"
for tool_name in $TOOL_LIST; do
echo "Checking tool: $tool_name"
tool_path=$(which "$tool_name")
if [ -z "$tool_path" ]; then
echo -e "${RED}ERROR: Missing tool '$tool_name' ${NC}"
exit 1
fi
done
check_tools "printf dd grep awk"
# check the project root folder
if [ ! -d "$project_root" ]; then
echo -e "${RED}ERROR: Cannot find the folder '$project_root' ${NC}"
exit 3
fi
# check the input file
if [ ! -f "$def_target" ]; then

View file

@ -1,10 +1,5 @@
#!/bin/bash
# global definitions:
RED='\033[0;31m'
GREEN='\033[0;32m'
NC='\033[0m'
# check the parameters
if [ $# != 2 ]; then
echo "usage : $0 <project_root> <opkg_package>"
@ -15,15 +10,7 @@ project_root="$1"
opkg_package="$2"
# check the required tools
TOOL_LIST="unzip grep sed"
for tool_name in $TOOL_LIST; do
echo "Checking tool: $tool_name"
tool_path=$(which "$tool_name")
if [ -z "$tool_path" ]; then
echo -e "${RED}ERROR: Missing tool '$tool_name' ${NC}"
exit 1
fi
done
check_tools "unzip grep sed"
# check the project root folder
if [ ! -d "$project_root" ]; then
@ -32,7 +19,7 @@ if [ ! -d "$project_root" ]; then
fi
# check the opkg package folder
opkg_package_folder="${project_root}/RESOURCES/OPTIONS/opkg/${opkg_package}"
opkg_package_folder="${OPTIONS_DIR}/opkg/${opkg_package}"
if [ ! -d "$opkg_package_folder" ]; then
echo -e "${RED}ERROR: Cannot find the folder '$opkg_package_folder' ${NC}"
exit 4
@ -46,7 +33,7 @@ if [ ! -f "$opkg_package_file" ]; then
fi
# check the target folder
target_folder="$project_root/unpacked/squashfs-root"
target_folder="$ROOTFS_DIR"
if [ ! -d "$target_folder" ]; then
echo -e "${RED}ERROR: Cannot find the target folder '$target_folder' ${NC}"
exit 6
@ -57,13 +44,13 @@ current_folder="$PWD"
cd "$target_folder" || exit 7
unzip -o "$opkg_package_file"
# add "/opt/etc/init.d/rc.unslung start" to $project_root/unpacked/squashfs-root/etc/rc.local before the exit 0 line
result=$(grep "/opt/etc/init.d/rc.unslung start" "$project_root/unpacked/squashfs-root/etc/rc.local")
result=$(grep "/opt/etc/init.d/rc.unslung start" "$ROOTFS_DIR/etc/rc.local")
if [ -z "$result" ]; then
# add it only if not already done
sed -i '/exit 0/i /opt/etc/init.d/rc.unslung start' "$project_root/unpacked/squashfs-root/etc/rc.local"
sed -i '/exit 0/i /opt/etc/init.d/rc.unslung start' "$ROOTFS_DIR/etc/rc.local"
fi
# extend the PATH to $project_root/unpacked/squashfs-root/etc/profile
sed -i 's#export PATH="/usr/sbin:/usr/bin:/sbin:/bin"#export PATH="/usr/sbin:/usr/bin:/sbin:/bin:/opt/sbin:/opt/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin"#' "$project_root/unpacked/squashfs-root/etc/profile"
sed -i 's#export PATH="/usr/sbin:/usr/bin:/sbin:/bin"#export PATH="/usr/sbin:/usr/bin:/sbin:/bin:/opt/sbin:/opt/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin"#' "$ROOTFS_DIR/etc/profile"
cd "$current_folder" || exit 8
echo -e "${GREEN}SUCCESS: The '$opkg_package' opkg package has been installed ${NC}"

View file

@ -1,10 +1,5 @@
#!/bin/bash
# global definitions:
RED='\033[0;31m'
GREEN='\033[0;32m'
NC='\033[0m'
# check the parameters
if [ $# != 2 ]; then
echo "usage : $0 <project_root> <python_package>"
@ -15,15 +10,7 @@ project_root="$1"
python_package="$2"
# check the required tools
TOOL_LIST="unzip sed"
for tool_name in $TOOL_LIST; do
echo "Checking tool: $tool_name"
tool_path=$(which "$tool_name")
if [ -z "$tool_path" ]; then
echo -e "${RED}ERROR: Missing tool '$tool_name' ${NC}"
exit 1
fi
done
check_tools "unzip sed"
# check the project root folder
if [ ! -d "$project_root" ]; then
@ -32,7 +19,7 @@ if [ ! -d "$project_root" ]; then
fi
# check the python package folder
python_package_folder="${project_root}/RESOURCES/OPTIONS/python/${python_package}"
python_package_folder="${OPTIONS_DIR}/python/${python_package}"
if [ ! -d "$python_package_folder" ]; then
echo -e "${RED}ERROR: Cannot find the folder '$python_package_folder' ${NC}"
exit 4
@ -46,7 +33,7 @@ if [ ! -f "$python_package_file" ]; then
fi
# check the target folder
target_folder="$project_root/unpacked/squashfs-root"
target_folder="$ROOTFS_DIR"
if [ ! -d "$target_folder" ]; then
echo -e "${RED}ERROR: Cannot find the target folder '$target_folder' ${NC}"
exit 6
@ -57,7 +44,7 @@ current_folder="$PWD"
cd "$target_folder" || exit 7
unzip -o "$python_package_file"
# extend the PATH to $project_root/unpacked/squashfs-root/etc/profile
sed -i 's#export PATH="/usr/sbin:/usr/bin:/sbin:/bin"#export PATH="/usr/sbin:/usr/bin:/sbin:/bin:/opt/sbin:/opt/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin"#' "$project_root/unpacked/squashfs-root/etc/profile"
sed -i 's#export PATH="/usr/sbin:/usr/bin:/sbin:/bin"#export PATH="/usr/sbin:/usr/bin:/sbin:/bin:/opt/sbin:/opt/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin"#' "$ROOTFS_DIR/etc/profile"
cd "$current_folder" || exit 8
echo -e "${GREEN}The python package has been successfully installed ${NC}"

View file

@ -1,10 +1,5 @@
#!/bin/bash
# global definitions:
RED='\033[0;31m'
GREEN='\033[0;32m'
NC='\033[0m'
# check the parameters
if [ $# != 2 ]; then
echo "usage : $0 <project_root> <password_hash>"
@ -15,15 +10,7 @@ project_root="$1"
password_hash="$2"
# check the required tools
TOOL_LIST="awk"
for tool_name in $TOOL_LIST; do
echo "Checking tool: $tool_name"
tool_path=$(which "$tool_name")
if [ -z "$tool_path" ]; then
echo -e "${RED}ERROR: Missing tool '$tool_name' ${NC}"
exit 1
fi
done
check_tools "awk"
# check the project root folder
if [ ! -d "$project_root" ]; then
@ -32,7 +19,7 @@ if [ ! -d "$project_root" ]; then
fi
# check the target file
target_file="$project_root/unpacked/squashfs-root/etc/shadow"
target_file="$ROOTFS_DIR/etc/shadow"
if [ ! -f "$target_file" ]; then
echo -e "${RED}ERROR: Cannot find the target file '$target_file' ${NC}"
exit 3

View file

@ -1,10 +1,5 @@
#!/bin/bash
# global definitions:
RED='\033[0;31m'
GREEN='\033[0;32m'
NC='\033[0m'
# check the parameters
if [ $# != 2 ]; then
echo "usage : $0 <project_root> <ssh_package>"
@ -15,15 +10,7 @@ project_root="$1"
ssh_package="$2"
# check the required tools
TOOL_LIST="unzip grep sed"
for tool_name in $TOOL_LIST; do
echo "Checking tool: $tool_name"
tool_path=$(which "$tool_name")
if [ -z "$tool_path" ]; then
echo -e "${RED}ERROR: Missing tool '$tool_name' ${NC}"
exit 1
fi
done
check_tools "unzip grep sed"
# check the project root folder
if [ ! -d "$project_root" ]; then
@ -32,7 +19,7 @@ if [ ! -d "$project_root" ]; then
fi
# check the ssh package folder
ssh_package_folder="${project_root}/RESOURCES/OPTIONS/ssh/${ssh_package}"
ssh_package_folder="$OPTIONS_DIR/ssh/${ssh_package}"
if [ ! -d "$ssh_package_folder" ]; then
echo -e "${RED}ERROR: Cannot find the folder '$ssh_package_folder' ${NC}"
exit 4
@ -46,7 +33,7 @@ if [ ! -f "$ssh_package_file" ]; then
fi
# check the target folder
target_folder="$project_root/unpacked/squashfs-root"
target_folder="$ROOTFS_DIR"
if [ ! -d "$target_folder" ]; then
echo -e "${RED}ERROR: Cannot find the target folder '$target_folder' ${NC}"
exit 6
@ -57,13 +44,13 @@ current_folder="$PWD"
cd "$target_folder" || exit 7
unzip -o "$ssh_package_file"
# add "/opt/etc/init.d/rc.unslung start" to $project_root/unpacked/squashfs-root/etc/rc.local before the exit 0 line
result=$(grep "/opt/etc/init.d/rc.unslung start" "$project_root/unpacked/squashfs-root/etc/rc.local")
result=$(grep "/opt/etc/init.d/rc.unslung start" "$ROOTFS_DIR/etc/rc.local")
if [ -z "$result" ]; then
# add it only if not already done
sed -i '/exit 0/i /opt/etc/init.d/rc.unslung start' "$project_root/unpacked/squashfs-root/etc/rc.local"
sed -i '/exit 0/i /opt/etc/init.d/rc.unslung start' "$ROOTFS_DIR/etc/rc.local"
fi
# extend the PATH to $project_root/unpacked/squashfs-root/etc/profile
sed -i 's#export PATH="/usr/sbin:/usr/bin:/sbin:/bin"#export PATH="/usr/sbin:/usr/bin:/sbin:/bin:/opt/sbin:/opt/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin"#' "$project_root/unpacked/squashfs-root/etc/profile"
sed -i 's#export PATH="/usr/sbin:/usr/bin:/sbin:/bin"#export PATH="/usr/sbin:/usr/bin:/sbin:/bin:/opt/sbin:/opt/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin"#' "$ROOTFS_DIR/etc/profile"
cd "$current_folder" || exit 8
echo -e "${GREEN}The ssh package has been successfully installed ${NC}"

View file

@ -1,10 +1,5 @@
#!/bin/bash
# global definitions:
RED='\033[0;31m'
GREEN='\033[0;32m'
NC='\033[0m'
# check the parameters
if [ $# != 2 ]; then
echo "usage : $0 <project_root> <startup_script>"
@ -15,18 +10,10 @@ project_root="$1"
startup_script="$2"
# check the required tools
TOOL_LIST="sed"
for tool_name in $TOOL_LIST; do
echo "Checking tool: $tool_name"
tool_path=$(which "$tool_name")
if [ -z "$tool_path" ]; then
echo -e "${RED}ERROR: Missing tool '$tool_name' ${NC}"
exit 1
fi
done
check_tools "sed"
# Check if $startup_script is available
if [ ! -f "$project_root/RESOURCES/OPTIONS/startup_script/$startup_script" ]; then
if [ ! -f "$OPTIONS_DIR/startup_script/$startup_script" ]; then
echo -e "${RED}ERROR: Cannot find the file '$startup_script' ${NC}"
exit 2
fi
@ -38,20 +25,20 @@ if [ ! -d "$project_root" ]; then
fi
# Check if $project_root/RESOURCES/KEYS/mosquitto exists
if [ ! -d "$project_root/RESOURCES/KEYS/mosquitto" ]; then
echo -e "${RED}ERROR: Cannot find the folder '$project_root/RESOURCES/KEYS/mosquitto' ${NC}"
if [ ! -d "$KEYS_DIR/mosquitto" ]; then
echo -e "${RED}ERROR: Cannot find the folder '$KEYS_DIR/mosquitto' ${NC}"
exit 4
fi
# Copy everything from $project_root/RESOURCES/KEYS/mosquitto to $project_root/unpacked/squashfs-root/etc/ssl/certs
mkdir -p "$project_root/unpacked/squashfs-root/etc/ssl/certs"
cp -rf "$project_root/RESOURCES/KEYS/mosquitto"/* "$project_root/unpacked/squashfs-root/etc/ssl/certs"
mkdir -p "$ROOTFS_DIR/etc/ssl/certs"
cp -rf "$KEYS_DIR/mosquitto"/* "$ROOTFS_DIR/etc/ssl/certs"
# Move $startup_script to project root/unpacked/squashfs-root/etc
cp -rf "$project_root/RESOURCES/OPTIONS/startup_script/$startup_script" "$project_root/unpacked/squashfs-root/etc"
cp -rf "$OPTIONS_DIR/startup_script/$startup_script" "$ROOTFS_DIR/etc"
# Add /etc/$startup_script to $project_root/unpacked/squashfs-root/etc/rc.local before the exit 0 line
sed -i "/exit 0/i /etc/$startup_script" "$project_root/unpacked/squashfs-root/etc/rc.local"
sed -i "/exit 0/i /etc/$startup_script" "$ROOTFS_DIR/etc/rc.local"
echo -e "${GREEN}INFO: Startup script '$startup_script' has been installed ${NC}"

View file

@ -1,10 +1,5 @@
#!/bin/bash
# global definitions:
RED='\033[0;31m'
GREEN='\033[0;32m'
NC='\033[0m'
# check the parameters
if [ $# != 2 ]; then
echo "usage : $0 <project_root> <uart_package>"
@ -15,15 +10,7 @@ project_root="$1"
uart_package="$2"
# check the required tools
TOOL_LIST="unzip"
for tool_name in $TOOL_LIST; do
echo "Checking tool: $tool_name"
tool_path=$(which "$tool_name")
if [ -z "$tool_path" ]; then
echo -e "${RED}ERROR: Missing tool '$tool_name' ${NC}"
exit 1
fi
done
check_tools "unzip"
# check the project root folder
if [ ! -d "$project_root" ]; then
@ -32,7 +19,7 @@ if [ ! -d "$project_root" ]; then
fi
# check the uart package folder
uart_package_folder="${project_root}/RESOURCES/OPTIONS/uart/${uart_package}"
uart_package_folder="${OPTIONS_DIR}/uart/${uart_package}"
if [ ! -d "$uart_package_folder" ]; then
echo -e "${RED}ERROR: Cannot find the folder '$uart_package_folder' ${NC}"
exit 4
@ -46,7 +33,7 @@ if [ ! -f "$uart_package_file" ]; then
fi
# check the target folder
target_folder="$project_root/unpacked"
target_folder="$ROOTFS_DIR"
if [ ! -d "$target_folder" ]; then
echo -e "${RED}ERROR: Cannot find the target folder '$target_folder' ${NC}"
exit 6