mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Use braces and quotes appropriately
This commit is contained in:
17
.github/scripts/rename/config.sh
vendored
17
.github/scripts/rename/config.sh
vendored
@@ -5,7 +5,7 @@ set -e
|
|||||||
|
|
||||||
# On MacOS, ensure that GNU sed is installed and available as `gsed`.
|
# On MacOS, ensure that GNU sed is installed and available as `gsed`.
|
||||||
SED_COMMAND=sed
|
SED_COMMAND=sed
|
||||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
if [[ "${OSTYPE}" == 'darwin'* ]]; then
|
||||||
if ! command -v gsed &> /dev/null; then
|
if ! command -v gsed &> /dev/null; then
|
||||||
echo "Error: gsed is not installed. Please install it using 'brew install gnu-sed'."
|
echo "Error: gsed is not installed. Please install it using 'brew install gnu-sed'."
|
||||||
exit 1
|
exit 1
|
||||||
@@ -28,25 +28,25 @@ if [ ! -d "${DIRECTORY}" ]; then
|
|||||||
echo "Error: Directory '${DIRECTORY}' does not exist."
|
echo "Error: Directory '${DIRECTORY}' does not exist."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
pushd ${DIRECTORY}
|
||||||
|
|
||||||
# Add the xrpld.cfg to the .gitignore.
|
# Add the xrpld.cfg to the .gitignore.
|
||||||
if ! grep -q 'xrpld.cfg' ${DIRECTORY}/.gitignore; then
|
if ! grep -q 'xrpld.cfg' .gitignore; then
|
||||||
${SED_COMMAND} -i '/rippled.cfg/a\
|
${SED_COMMAND} -i '/rippled.cfg/a\
|
||||||
xrpld.cfg' ${DIRECTORY}/.gitignore
|
xrpld.cfg' .gitignore
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Rename the files.
|
# Rename the files.
|
||||||
if [ -e "${DIRECTORY}/rippled.cfg" ]; then
|
if [ -e rippled.cfg ]; then
|
||||||
mv "${DIRECTORY}/rippled.cfg" "${DIRECTORY}/xrpld.cfg"
|
mv rippled.cfg xrpld.cfg
|
||||||
fi
|
fi
|
||||||
if [ -e "${DIRECTORY}/cfg/rippled-example.cfg" ]; then
|
if [ -e cfg/rippled-example.cfg ]; then
|
||||||
mv "${DIRECTORY}/cfg/rippled-example.cfg" "${DIRECTORY}/cfg/xrpld-example.cfg"
|
mv cfg/rippled-example.cfg cfg/xrpld-example.cfg
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Rename inside the files.
|
# Rename inside the files.
|
||||||
DIRECTORIES=("cfg" "cmake" "include" "src")
|
DIRECTORIES=("cfg" "cmake" "include" "src")
|
||||||
for DIRECTORY in "${DIRECTORIES[@]}"; do
|
for DIRECTORY in "${DIRECTORIES[@]}"; do
|
||||||
DIRECTORY=$1/${DIRECTORY}
|
|
||||||
echo "Processing directory: ${DIRECTORY}"
|
echo "Processing directory: ${DIRECTORY}"
|
||||||
if [ ! -d "${DIRECTORY}" ]; then
|
if [ ! -d "${DIRECTORY}" ]; then
|
||||||
echo "Error: Directory '${DIRECTORY}' does not exist."
|
echo "Error: Directory '${DIRECTORY}' does not exist."
|
||||||
@@ -59,4 +59,5 @@ for DIRECTORY in "${DIRECTORIES[@]}"; do
|
|||||||
done
|
done
|
||||||
done
|
done
|
||||||
|
|
||||||
|
popd
|
||||||
echo "Renaming complete."
|
echo "Renaming complete."
|
||||||
|
|||||||
Reference in New Issue
Block a user