Hi On Mon, 28 Apr 2025 08:50:39 -0700 "Doug H." wrote:
> Does anybody have an opinion on this? Seeing the postfix bug introduced by that (no sendmail), I wrote the attached script to finish the merge. It already worked on a few machines. -- francis
#!/bin/bash -p dont () { if [ "$DONT" ] then echo "$@" else "$@" fi } bad_usage () { local name=$1 shift echo >&2 "\ ** ${name##*/}: Uncorrect usage: $* ** Cf: $name --help" } #---+ usr-bin-usr-sbin-unification # Ref: https://docs.fedoraproject.org/en-US/fedora/latest/release-notes/sysadmin/#usr-bin-usr-sbin-unification fix-usr-sbin () { local usage="\ Usage: $FUNCNAME [OPTIONS] Finishes the unification of /usr/bin and /usr/sbin During an upgrade to F42, most of the files in /usr/sbin are converted to symlinks to ../bin/ This command moves the remaining files and links to /usr/bin then defines /usr/sbin as a symlink to /usr/bin. Checks are done that no conflicts exist for those files/links like: - a file must not exist in /usr/bin and /usr/sbin or as a symlink to /usr/sbin Options: --help This help -n,--dry-run Dry run " local -a initargs=( "$@" ) # For eventual re-use local -A opts local -a args while (($# > 0)); do case $1 in --help ) echo "$usage" return 0 ;; -n | --dry-run ) local DONT=true opts['dry-run']=true ;; -- ) # End of options shift break ;; -* ) bad_usage $FUNCNAME "Unknown option: $1" return 2 ;; # Options everywhere * ) args+=( "$1" ) ;; esac shift done # Arguments back in $@ set -- "${args[@]}" "$@" local err="$FUNCNAME: *** Error:" ## sanity checks local releasever=$(rpm -qf --qf '%{version}' /etc/fedora-release \ 2> /dev/null) if ! [ "$releasever" ] || (( releasever < 42 )); then echo >&2 "$err wrong fedora release: $releasever. Stop" return 1 fi ## already correct if [[ "$(readlink /usr/sbin)" = bin ]]; then echo "$FUNCNAME: /usr/sbin points to bin: nothing to do" return 0 fi ## files in /usr/sbin # that dont exist in /usr/bin or as symlink to /usr/sbin # Exception: /usr/sbin/iconvconfig is not owned by any package # ldconfig also local -a files=( $(find /usr/sbin -type f \ ! -name iconvconfig \ ! -name ldconfig \ -printf '%f\n') ) local file for file in "${files[@]}"; do if [ -e /usr/bin/$file ]; then case "$(readlink /usr/bin/$file)" in "../../usr/sbin/$file" \ | "../sbin/$file" \ | "/usr/sbin/$file" ) ;; * ) echo >&2 "$err $file exist in /usr/bin and /usr/sbin. Stop" return 2 ;; esac fi done ## links in /usr/sbin but not to ../bin local -a links=( $(find /usr/sbin -type l ! -lname '../bin*' \ -printf '%f\n') ) local link for link in "${links[@]}"; do if [ -e /usr/bin/$link ]; then echo >&2 "$err $link exist in /usr/bin and /usr/sbin. Stop" return 2 fi done ## go ( cd /usr/sbin && dont mv --force "${files[@]}" /usr/bin ) || return ( cd /usr/sbin && dont mv --force "${links[@]}" /usr/bin ) || return dont mv /usr/sbin /usr/sbin-pre-F42 || return dont ln -s bin /usr/sbin || return } #---+ postfix fix-postfix-inria () { local usage="\ Usage: $FUNCNAME [OPTIONS] Following the /usr/bin /usr/sbin unification, the alternatives for postfix are broken: sendmail not found This command attempt to correct that Options: --help This help -n,--dry-run Dry run " local -a initargs=( "$@" ) # For eventual re-use local -A opts local -a args while (($# > 0)); do case $1 in --help ) echo "$usage" return 0 ;; -n | --dry-run ) local DONT=true opts['dry-run']=true ;; -- ) # End of options shift break ;; -* ) bad_usage $FUNCNAME "Unknown option: $1" return 2 ;; # Options everywhere * ) args+=( "$1" ) ;; esac shift done # Arguments back in $@ set -- "${args[@]}" "$@" if ! rpm -q postfix &> /dev/null; then echo "$FUNCNAME: postfix is not installed: noop" return 0 fi ( [ "$DONT" ] || set -x dont dnf -y remove --no-autoremove postfix dont alternatives --remove mta /usr/sbin/sendmail.postfix dont dnf -y install postfix dont systemctl enable postfix.service dont postconf -e relayhost=smtp.inria.fr dont postconf -e mydomain=inria.fr ) }
-- _______________________________________________ users mailing list -- users@lists.fedoraproject.org To unsubscribe send an email to users-le...@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/users@lists.fedoraproject.org Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue