akemin-dayo / PreferenceOrganizer2

Organise the iOS Settings app!
https://cydia.akemi.ai/?page/net.angelxwind.preferenceorganizer2
BSD 2-Clause "Simplified" License
61 stars 33 forks source link

postrm script fails on iOS 14 because wrong shell is used #51

Closed jacobseptember closed 3 years ago

jacobseptember commented 3 years ago

I realize iOS 14 is not supported yet, but...

When trying to uninstall, dpkg returns an error that is traced back to line 3 of postrm: declare: not found. The script's hashbang is #!/bin/sh which in older iOS versions referenced bash; in iOS 14 some other shell is referenced by default, and that shell does not support declare.

Editing the script's hashbang to #!/bin/bash allows the uninstall to proceed.

m1stadev commented 3 years ago

This is due to the Procursus bootstrap switching /bin/sh from bash to dash, which means that the package maintainer scripts should be POSIX-compliant (which they should be if they're using /bin/sh anyways). The easy fix would be to make the package maintainer scripts use /bin/bash, but ideally the scripts should be rewritten to be POSIX-compliant.

akemin-dayo commented 3 years ago

Fixed as of commit ba14f6560ac3eb19125e1dfb0ec065ec89132950.

This bug really has just been sitting there for years now, huh? I usually get the hashbang invocation correct, not sure what happened here l o l

These scripts, as well as basically the vast majority of my scripts, are not POSIX-compliant because I generally tend to use bash-specific features in all the shell scripts I write.

(I was actually thinking of transitioning to #!/usr/bin/env bash as it's a far more portable invocation, but decided against it for this commit at least until I have time to test the behaviour on iOS 5/6.)

m1stadev commented 3 years ago

@akemin-dayo Could you add bash as a dependency as well? (request from Hayden)

akemin-dayo commented 3 years ago

Added as of commit 48fc0bf057c0552f28635c9c90afbbcc482ddff6.

Does the Procursus bootstrap no longer ship bash by default, then? (As in — will I have to start adding bash to my Depends fields in the future?)

m1stadev commented 3 years ago

Procursus still ships bash by default, but I believe that Hayden intends to remove bash from the default packages eventually, so I'd recommend doing so. Also, thank you for fixing this!

Diatrus commented 3 years ago

Thanks for fixing this, and yes, sometime in the far far future, I was hoping to remove bash. I’ll obviously announce that intention first and give people time to add to their depends, but I hope it’ll work out.

akemin-dayo commented 3 years ago

Huh — curious, what are the reasons behind this decision? Seems to me that all it'd do is break compatibility with people's packages with not much upsides (aside from, I guess, one less thing to maintain)?

Diatrus commented 3 years ago

@akemin-dayo Right now Procursus ships 3 default shells. I just wanted to knock that down to 2. Less essential packages is always a goal I aim toward. It wouldn’t be removed for previous iOS versions, it just wouldn’t be shipped in the first iOS 16 jailbreak (assuming that’s when I chose to get rid of it by default).

Before that happens, I’m going to make it a goal to try and help every developer make their scripts POSIX compliant.