View Issue Details

IDProjectCategoryView StatusLast Update
0006016unrealinstallingpublic2021-12-29 09:36
Reporterrafaelgrether Assigned Tosyzop  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
PlatformanyOSFreeBSDOS Version13
Product Version6.0.0-rc1 
Fixed in Version6.0.1 
Summary0006016: ./unreal upgrade not working on FreeBSD and some suggestions
DescriptionHello guys,

On FreeBSD, when I run "./unrealircd upgrade", returns the error:

$ ./unrealircd upgrade
./unrealircd: /home/unrealircd/unrealircd/bin/unrealircd-upgrade-script: not found

I debug the script shell "unrealircd-upgrade-script" and found the problem.
The shebang #!/bin/bash doesn't exist on FreeBSD at this location.

On FreeBSD, bash (when installed) is located at /usr/local/bin/bash

If bash is really needed, I suggest to use dynamic path for shebang on the first line:

#!/usr/bin/env bash

Another suggestion, BASH have a global variable for OS Detection ($OSTYPE)
So, I changed few lines of "unrealircd-upgrade-script", using "wget" only on Linux systems, and using "fetch" (default) on FreeBSD.

    58 #FreeBSD uses fetch to retrieve a file
    59 if [[ "$OSTYPE" != "freebsd"* ]] ; then
    60 if ! wget --help 1>/dev/null 2>&1 ; then
                       .....................
    67 fi
    68 fi

    82 # Download the install script
    83 if [[ "$OSTYPE" == "freebsd"* ]] ; then
    84 fetch -o unrealircd-upgrade-script.stage2 "https://www.unrealircd.org/downloads/unrealircd-upgrade-script.stage2?from=$UNREALVER" || fail "Could not download online installer"
    85 fetch -o unrealircd-upgrade-script.stage2.asc "https://www.unrealircd.org/downloads/unrealircd-upgrade-script.stage2.asc" || fail "Could not download online installer signature"
    86 else
    87 wget -O unrealircd-upgrade-script.stage2 "https://www.unrealircd.org/downloads/unrealircd-upgrade-script.stage2?from=$UNREALVER" || fail "Could not download online installer"
    88 wget -O unrealircd-upgrade-script.stage2.asc "https://www.unrealircd.org/downloads/unrealircd-upgrade-script.stage2.asc" || fail "Could not download online installer signature"
    89 fi

And the help installation of gpg, that on FreeBSD is at gnupg package:

   110 if [[ "$OSTYPE" == "freebsd"* ]] ; then
   111 echo "On FreeBSD consider running 'sudo pkg install gnupg'"
   112 else
   113 echo "On Linux consider running 'sudo apt install gpg' or 'yum install gnupg2'"
   114 fi

If suggestions are appreciated, the complete modified "unrealircd-upgrade-script" is at pastebin: https://pastebin.com/pGAw1s6w

The same could be replicated on "unrealircd-upgrade-script.stage2", using shebang #!/usr/bin/env bash to avoid errors, and using wget (on linux) or fetch (on FreeBSD).
TagsNo tags attached.
3rd party modules

Activities

syzop

2021-12-29 09:36

administrator   ~0022322

Thanks a lot for the suggestions/patch! I have now done this in git, will be in 6.0.1. Online script updated as well. Tested on FreeBSD 12.

https://github.com/unrealircd/unrealircd/commit/607d2bcd62b2ab36db47965f7366368d9fce5b23

commit 607d2bcd62b2ab36db47965f7366368d9fce5b23 (HEAD -> unreal60_dev, origin/unreal60_dev)
Author: Bram Matthys <syzop@vulnscan.org>
Date: Wed Dec 29 09:30:35 2021 +0100

    Make "./unrealircd upgrade" work on FreeBSD.
    Suggested by and patches from rafaelgrether in
    https://bugs.unrealircd.org/view.php?id=6016
    
    This also cleans up a tiny bit, part of it suggested by Lord255 in
    https://bugs.unrealircd.org/view.php?id=5963

Issue History

Date Modified Username Field Change
2021-11-30 19:58 rafaelgrether New Issue
2021-12-01 18:54 syzop Assigned To => syzop
2021-12-01 18:54 syzop Status new => acknowledged
2021-12-29 09:36 syzop Status acknowledged => resolved
2021-12-29 09:36 syzop Resolution open => fixed
2021-12-29 09:36 syzop Fixed in Version => 6.0.1
2021-12-29 09:36 syzop Note Added: 0022322