Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix drbd.conf's empty content problem #75

Merged
merged 1 commit into from
Apr 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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