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

Improve sed patch to work without gsed #1224

Merged
merged 2 commits into from
Dec 14, 2024
Merged

Conversation

Samueru-sama
Copy link
Contributor

@Samueru-sama Samueru-sama commented Dec 14, 2024

Related to #1199

Now am is able to install apps when there is only bsd sed without gnu sed, tested without and with gsed on chimera linux (bsd userland):

image

(Note the broken sed detected message is for testing, I put it where the variable about sed gets set)


Explanation:

  • We check the version of sed, if it is not gnu sed the variable NO_SED_I=true gets set.

  • The sed function will check for if [ "$NO_SED_I" = true ] && [ "$1" = '-i' ]; then, if both a true it tries to see if we have gsed, if true it uses gsed by default.

  • If there is no gsed it then applies a workaround that drops the -i flag (shift) and puts the sed command in a variable $tmpsedYYY and finally that variable replaces the file we just edited echo "$tmpsedYYY" > "$1" all while doing a some sanity checks.

  • If for some reason something goes wrong an error message explaining that situation and asking the error to install gsed is given.

@ivan-hc ivan-hc merged commit 3b3b8ba into ivan-hc:dev Dec 14, 2024
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.

2 participants