mirror of
https://github.com/gtxaspec/wz_mini_hacks.git
synced 2025-08-09 20:14:04 +00:00
init: add S00config, validate and repair invalid line endings in wz_mini.conf
This commit is contained in:
27
SD_ROOT/wz_mini/etc/init.d/S00config
Normal file
27
SD_ROOT/wz_mini/etc/init.d/S00config
Normal file
@@ -0,0 +1,27 @@
|
||||
#!/bin/sh
|
||||
### BEGIN INIT INFO
|
||||
# Provides:
|
||||
# Short-Description: Validate wz_mini.conf
|
||||
# Description: Repair invalid line endings in the wz_mini.conf file.
|
||||
### END INIT INFO
|
||||
|
||||
CONFIG_FILE="/opt/wz_mini/wz_mini.conf"
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
|
||||
echo "#####$(basename "$0")#####"
|
||||
# Check if the file contains carriage return characters
|
||||
if grep -q $'\r' "$CONFIG_FILE"; then
|
||||
echo "Windows line endings detected in $CONFIG_FILE. Running dos2unix..."
|
||||
dos2unix "$CONFIG_FILE"
|
||||
echo "Conversion complete."
|
||||
else
|
||||
echo "No Windows line endings detected. Configuration file is valid."
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
@@ -1 +1 @@
|
||||
Sun Sep 17 07:45:40 PM PDT 2023
|
||||
Tue Sep 19 03:57:56 PM PDT 2023
|
||||
|
Reference in New Issue
Block a user