init: add S00config, validate and repair invalid line endings in wz_mini.conf

This commit is contained in:
gtxaspec
2023-09-19 15:58:48 -07:00
parent 5d3ac1aebe
commit 930cbe2e9d
3 changed files with 30 additions and 2 deletions

View 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

View File

@@ -1 +1 @@
Sun Sep 17 07:45:40 PM PDT 2023
Tue Sep 19 03:57:56 PM PDT 2023