Skip to content

Commit

Permalink
Merge pull request #75 from peng9808/main
Browse files Browse the repository at this point in the history
fix drbd.conf's empty content problem
  • Loading branch information
peng9808 authored Apr 26, 2024
2 parents 5c3b600 + d15727f commit ce5fbe2
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
20 changes: 15 additions & 5 deletions docker-drbd9/config-drbd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,21 @@
conf_file="/etc/drbd.conf"
example_file="/usr/share/doc/drbd.../drbd.conf.example"
content_to_append="include \"/etc/drbd.d/global_common.conf\";\ninclude \"/etc/drbd.d/*.res\";"
echo -e "# You can find an example in $example_file\n$content_to_append" > "$conf_file"
echo "Content successfully written to $conf_file."
if [ ! -s "$conf_file" ]; then
echo -e "# You can find an example in $example_file\n$content_to_append" > "$conf_file"
echo "Content successfully written to $conf_file."
else
echo "$conf_file exists and is not empty."
fi


conf_file2="/etc/drbd.d/global_common.conf"
content_to_write2="global { usage-count no; }"
mkdir -p "$(dirname "$conf_file2")"
echo "$content_to_write2" > "$conf_file2"
echo "Content successfully written to $conf_file2."

if [ ! -s "$conf_file2" ]; then
mkdir -p "$(dirname "$conf_file2")"
echo "$content_to_write2" > "$conf_file2"
echo "Content successfully written to $conf_file2."
else
echo "$conf_file2 exists and is not empty."
fi
6 changes: 6 additions & 0 deletions docker-drbd9/entry.sh
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,9 @@ if [ -n "$drbd_rpm" ]; then
if [ $exit_code -eq 0 ]; then
#Notify shipper that installation is complete
export DRBD_RMP_INSTALL='yes'
cp /config-drbd.sh /pkgs_root/config-drbd.sh
nsenter --target 1 --mount --uts --ipc --net --pid chmod +x /root/config-drbd.sh
nsenter --target 1 --mount --uts --ipc --net --pid /root/config-drbd.sh
exit 0
else
debug "modprobe err_code: $exit_code"
Expand Down Expand Up @@ -296,6 +299,9 @@ else
exit_code=$?
if [ $exit_code -eq 0 ]; then
export DRBD_RMP_INSTALL='yes'
cp /config-drbd.sh /pkgs_root/config-drbd.sh
nsenter --target 1 --mount --uts --ipc --net --pid chmod +x /root/config-drbd.sh
nsenter --target 1 --mount --uts --ipc --net --pid /root/config-drbd.sh
exit 0
else
debug "modprobe err_code: $exit_code"
Expand Down

0 comments on commit ce5fbe2

Please sign in to comment.