Add script to manage calibration file
Also rework the way config files are copied from SD card during boot.
This commit is contained in:
parent
988b0fbf27
commit
2a2f97c006
|
@ -0,0 +1,21 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Read configuration files from SD card.
|
||||
#
|
||||
|
||||
. /opt/puzzlefw/lib/functions.sh
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
echo "Reading configuration files from SD card ..."
|
||||
lock_config || exit 1
|
||||
read_config || exit 1
|
||||
;;
|
||||
stop|restart|reload)
|
||||
true
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 start"
|
||||
exit 1
|
||||
esac
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Manage analog channel calibration.
|
||||
#
|
||||
|
||||
. /opt/puzzlefw/lib/functions.sh
|
||||
|
||||
# Copy calibration file to the SD card.
|
||||
cal_save() {
|
||||
|
||||
# Lock to avoid conflicting changes.
|
||||
lock_config || exit 1
|
||||
|
||||
echo "Copying changed calibration to SD card ..."
|
||||
|
||||
sync_config calibration.conf || exit 1
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
show)
|
||||
cat ${CONFIG_DIR}/calibration.conf
|
||||
;;
|
||||
save)
|
||||
cal_save
|
||||
;;
|
||||
*)
|
||||
cat <<EOF
|
||||
Usage: $0 {show|save}
|
||||
|
||||
Manage analog channel calibration.
|
||||
|
||||
$0 show
|
||||
Display calibration.
|
||||
|
||||
$0 save
|
||||
Copy a changed calibration file to the SD card.
|
||||
Before running this command, the changed calibration must be written to
|
||||
${CONFIG_DIR}/calibration.conf.new.
|
||||
|
||||
EOF
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit $?
|
||||
|
|
@ -86,12 +86,12 @@ EOF
|
|||
# Initialize configuration from SD card.
|
||||
ipcfg_init() {
|
||||
|
||||
echo "Loading IP address configuration from SD card ..."
|
||||
echo "Activating saved IP address configuration ..."
|
||||
|
||||
# Copy configuration from SD card.
|
||||
# Lock to avoid conflicting changes.
|
||||
lock_config || exit 1
|
||||
read_config || exit 1
|
||||
|
||||
# Persistent configuration file has already been copied from SD card.
|
||||
# Copy persistent configuration to active configuration.
|
||||
cp -a ${CONFIG_DIR}/network.conf ${CONFIG_DIR}/network_active.conf
|
||||
|
||||
|
@ -280,7 +280,7 @@ Usage: $0 {init|show|config|save|restart}
|
|||
Manage IP address configuration.
|
||||
|
||||
$0 init
|
||||
Initialize IP address from saved configuration on SD card.
|
||||
Initialize IP address from saved configuration.
|
||||
This command is used during boot and should not be invoked manually.
|
||||
|
||||
$0 show
|
||||
|
|
Loading…
Reference in New Issue