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 warning thrown in update script regarding non-portable flag usage in cp #6197

Open
wants to merge 3 commits into
base: staging
Choose a base branch
from
Open
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
18 changes: 17 additions & 1 deletion update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,11 @@ fix_broken_dnslist_conf() {

}

version_greater_or_equal() {
printf '%s\n%s\n' "$1" "$2" | sort -V | head -n 1 | grep -q "^$2$"
}


############## End Function Section ##############

# Check permissions
Expand Down Expand Up @@ -1051,7 +1056,18 @@ $COMPOSE_COMMAND pull

# Fix missing SSL, does not overwrite existing files
[[ ! -d data/assets/ssl ]] && mkdir -p data/assets/ssl
cp -n -d data/assets/ssl-example/*.pem data/assets/ssl/
# Some distros are still using an old version of coreutils that hasn't deprecated -n yet. The --update=none syntax wasn't added until
# coreutils 9,3, which is when the deprecation warning was added - check for which is installed, and execute the appropriate
# command to avoid warnings.
cp_threshold_version="9.3"
cp_installed_version=$(cp --version | head -n 1 | awk '{print $NF}')
if version_greater_or_equal "$cp_installed_version" "$cp_threshold_version"; then
# coreutils >= 9.3
cp --update=none -d data/assets/ssl-example/*.pem data/assets/ssl/
else
# coreutils < 9.3
cp -n -d data/assets/ssl-example/*.pem data/assets/ssl/
fi

echo -e "Checking IPv6 settings... "
if grep -q 'SYSCTL_IPV6_DISABLED=1' mailcow.conf; then
Expand Down