Skip to content

Fix bashisms, download using HTTPS #5

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

juliogonzalez
Copy link
Owner

Fixes #4

  • Avoid using bash specifics, as in the end this is all being run with /bin/sh
  • The patch on Lokigames was downloaded using HTTP, but now HTTPS is enforced by using a link so:
    • Always use HTTPS
    • Follow links in case the file gets moved later to another location.
    • Do the same for the Loki Compat tarball.

@greyscale42, I don't have Sim City 3000 installed or available right now, so I could test downloading the patch and patching the path, but not the rest.

Would you mind giving this a try? You just need to use the branch remove-bashisms instead of master

@greyscale42
Copy link

I git cloned the remove-bashisms branch and ran the script again.

It downloads a file successfully but then I get this:

patching file sc3u-2.0a-x86.run
[sudo] password for liz:
sc3u-2.0a-x86.run: 7: [: x86_64: unexpected operator
Verifying archive integrity...OK
Uncompressing SimCity 3000 Unlimited 2.0a Update.........................................................................
chown: warning: '.' should be ':': ‘0.0’
./update.sh: 56: loki_patch: not found
The program returned an error code (1)

@juliogonzalez
Copy link
Owner Author

Ok, seems Deb-based systems got bit more picky about bashisms, for some reasom (in any case the fault is mine for using them).

I could reproduce the issue on Debian 11, Debian 12, Ubuntu 24.04 containers, but not on openSUSE Leap 15.6 containers.

With that, I was able to fix issues on Deb-based systems, and I am able to get the point were the patch asks me questions, in all those four OS:

 ./sc3u-patcher.sh
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 7268k  100 7268k    0     0  3344k      0  0:00:02  0:00:02 --:--:-- 3343k
patching file sc3u-2.0a-x86.run
Verifying archive integrity...OK
Uncompressing SimCity 3000 Unlimited 2.0a Update.........................................................................
chown: warning: '.' should be ':': ‘0.0’
=============================================================
Welcome to the SimCity 3000 Unlimited 2.0a Update
=============================================================

Would you like to read the README for this update?  [Y/n]: 

The chown warning is harmless for now, but could be I need to address it at some point. It only happens for me on Ubuntu 24.04 as the old syntax is deprecated.

If you pull the latest changes from the branch remove-bashisms, you should hopefully be able to run everything. Make sure you remove sc3u-2.0a-x86.run from your local git repo, as it will be wrongly patched and needs to be patched again before applying.

@greyscale42
Copy link

greyscale42 commented Apr 20, 2025

It got further but still one more error:

=============================================================
Welcome to the SimCity 3000 Unlimited 2.0a Update
=============================================================

Would you like to read the README for this update?  [Y/n]: n

=============================================================
Would you like to apply this update? [Y/n]: y

Please enter the installation path: []: /home/liz/Games/SimCity3000Unlimited

=============================================================
Performing update:
Computing MD5 sums for new uninstaller, this may take a while...
cp: cannot stat '/home/liz/Games/SimCity3000Unlimited/sc3u': No such file or directory
ERROR: Can't find /home/liz/Games/SimCity3000Unlimited/sc3u.dynamic
The program returned an error code (3)

Thanks for the help btw. I appreciate it.

@juliogonzalez
Copy link
Owner Author

juliogonzalez commented Apr 21, 2025

@greyscale42 that error already comes from the patch from Loki itself.

Are you 100% sure the game is already installed at that path /home/liz/Games/SimCity3000Unlimited/sc3u?

I can reproduce your problem inside a Debian 12 container where the game is not installed at the directory I provide (/root/iamempty in my case, which is an empty directory).

root@060052fe9555:/sc3u-linux# ./sc3u-patcher.sh 
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 7268k  100 7268k    0     0  2034k      0  0:00:03  0:00:03 --:--:-- 2034k
patching file sc3u-2.0a-x86.run
Verifying archive integrity...OK
Uncompressing SimCity 3000 Unlimited 2.0a Update.........................................................................
chown: warning: '.' should be ':': '0.0'
=============================================================
Welcome to the SimCity 3000 Unlimited 2.0a Update
=============================================================

Would you like to read the README for this update?  [Y/n]: n

=============================================================
Would you like to apply this update? [Y/n]: y

Please enter the installation path: []: /root/iamempty

=============================================================
Performing update:
Computing MD5 sums for new uninstaller, this may take a while...
cp: cannot stat '/root/iamempty/sc3u': No such file or directory
ERROR: Can't find /root/iamempty/sc3u.dynamic
The program returned an error code (3)

Can you provide the output of ls -l /home/liz/Games/SimCity3000Unlimited/?

@greyscale42
Copy link

The sc3u directory isn't there I'm afraid. Here is the output of the command you asked for.

total 72
drwxr-xr-x 4 root root 4096 Apr 20 09:49 bacustom
drwxr-xr-x 2 root root 4096 Apr 20 09:49 barender
drwxr-xr-x 2 root root 4096 Apr 20 09:49 buildings
drwxr-xr-x 5 root root 4096 Apr 20 09:49 cities
-rw-r--r-- 1 root root 6530 Apr 20 09:49 hotkeys.txt
-rw-r--r-- 1 root root 3382 Apr 20 09:49 icon.bmp
-rw-r--r-- 1 root root 9003 Apr 20 09:49 icon.xpm
drwxr-xr-x 7 root root 4096 Apr 20 09:49 plugin
-rw-r--r-- 1 root root 7277 Apr 20 09:49 README
drwxr-xr-x 25 root root 4096 Apr 20 09:49 res
-rw-r--r-- 1 root root 550 Apr 20 09:49 sc3u.ini
-rw-r--r-- 1 root root 211 Apr 20 09:49 snapshot.ini
drwxr-xr-x 2 root root 4096 Apr 20 09:49 sys
-rwxr-xr-x 1 root root 665 Apr 20 19:45 uninstall

@juliogonzalez
Copy link
Owner Author

The sc3u directory isn't there I'm afraid. Here is the output of the command you asked for.

Doesn't seem like the installation of Sim City 3000 Unlimited is at /home/liz/Games/SimCity3000Unlimited/, as you are missing sc3u and sc3ru.dynamic (one is a wrapper, the other I seem to remember is a binary).

So either your Sim City 3000 Unlimited is broken, and you need to reinstall, or most likely/home/liz/Games/SimCity3000Unlimited/ only contains specific things for the liz user, such as customizations and more.

Check /usr/local/games/SC3U as that's the default path for the game.

In fact my script looks for the game at /usr/local/games/SC3U to adjust the sc3u wrapper (so if you are using a different path then that means I will need to modify the script further so you can specify it)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

curl not found
2 participants