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

Custom apt update upgrade autoremove alias will only update then stops. #231

Open
ru55-t opened this issue Aug 16, 2022 · 6 comments
Open
Labels

Comments

@ru55-t
Copy link

ru55-t commented Aug 16, 2022

I have a bash alias that as the title says updates upgrades cleans and autoremoves packages in apt that prior to installing synth-shell worked well but not after installing it.
It gets through the first update step and goes no further.

To Reproduce
From the terminal I type my alias (which you can view in the screenshot):
sal
then enter my passowrd and then apt starts the update process, finishtes that but then stops.

Expected behavior
Is that the apt alias 'sal' goes through all the update upgrade autoremove and cleaning steps without any stops.
I think my code is incompatible with synth-shell and I've tried a few different tacks in formatting, even aliasing a scirpt to complete the process to no avail.

Screenshots
Scrot-shot_2022-08-17_at_12:05:57-AM

Additional context
Changing apts update flash colour from ubuntu orange to a nicer green is the trick I'm trying to preserve and have only managed to get it working in this current format, with any deviations failing.
Any suggestions as a work around are welcome.
Cheers.

@ru55-t ru55-t added the bug label Aug 16, 2022
@andresgongora
Copy link
Owner

Hi. I'm looking into your issue right now. Let's get straight to it:

  1. Have you tried your alias with synth-shell-prompt disabled? Go to your bashrc file and simply comment the part where it is sourced. I'm 99% it's synth-shell-prompt and not any of the aliases that come packed along synth-shell.

  2. Assuming it's the colorized prompt. I guess it's interfering with your scripts own coloring. Just to know if this could be the problem; can you try running a modified version of your script with no colors or text formatting? Let me know, this could be an important lead. Maybe I forgot to unset a variable or something. Or maybe we have to insert a "$(tput sgr0)" somewhere to avoid collisions.

Cheers

@ru55-t
Copy link
Author

ru55-t commented Aug 25, 2022

Hi. Sorry for the late reply, life got a bit hectic but all is calm now.
Your right about commenting out synth-shell-prompt script, all aliases work as expected.
Re-enabled your script after removing all colour changes and any formatting like \n newline or any echoes from my .bash_aliases file then restarted tilda (also konsole & gnome-terminal) but no change.
It can't get past the first line which is simply:
sudo apt update
then at the next line is:
apt list -a -u

All colour changes removed completely, no fancy formatting and all aliases are simple one liners so could it be that the prompt script is simply stopping the alias at the end of the first line and going no further?

I've tried to emulate what your prompt script does with a PS1 line in the .bashrc file but that was disastrous lol so I reverted back.
Everything else works in your synth-shell package except the prompt script with my update alias.

On a side note your greeter script alerted me to a few failing services which is great and I've since remedied.
Cheers.

@andresgongora
Copy link
Owner

This is VERY odd. For instance, if you use the full synth-shell package, you get some aliases right out of the gate, such as history and ls among others and they usually work quite well. Could you send me a text version of your script? I don't use Debian but I could nonetheless try to run it.
Do your other aliases work?

@ru55-t
Copy link
Author

ru55-t commented Aug 26, 2022

Sure, it's quite long as I've accumulated a few aliases over the years mostly for convenience.
Yeah, all the other aliases are fine but I think this might be because their only 1 liners.
Could it be that I'm using sudo with apt?

So I've completey removed all .bash* files from my home directory and started from scratch.
Uninstalled synth-shell completely and reinstalled it leaving nothing out.
I have only setup the source .bash_aliases in .bashrc while only using the update all alias 'sal' in the .bash_aliases file.
Same results across all 3 terminals (konsole, gnome-terminal and tilda) then I disabled all but synteh-shell-prompt, restarted all terminals for the same results.

Then I put this back in .bash_aliases:
alias sau="sudo apt update -o APT::Color::Yellow='$(printf '\e[32m')'
echo -e '\n\033[32m* General update done.\033[0m\n'"

Restarted all 3 terminals and as predicted, it doesn't reach the second line.

bash_aliases.zip

@andresgongora
Copy link
Owner

andresgongora commented Aug 26, 2022 via email

@ru55-t
Copy link
Author

ru55-t commented Aug 27, 2022

No I haven't tried that, will give it a go.
Read up a little on both operators and did this:
alias sal="sudo apt update -o APT::Color::Yellow='$(printf '\e[32m')' && echo -e '\n\033[1;32m* General update finished, now upgrading any packages that need it...\033[0m\n' && apt list -a -u && # list upgradable && echo -e '\033[1;32m* Upgrade finished, autoremoving and cleaning up...\033[0m\n' && sudo apt autoremove -y # remove any orphaned package(s) dependencies && sudo apt clean && # clear apt cache && echo -e '\n\033[1;32m* All done.\033[0m\n' && soxbeep"
Alos tried:
alias sal="sudo apt update -o APT::Color::Yellow='$(printf '\e[32m')' \\ echo -e '\n\033[1;32m* General update finished, now upgrading any packages that need it...\033[0m\n' \\ apt list -a -u \\ # list upgradable \ echo -e '\033[1;32m* Upgrade finished, autoremoving and cleaning up...\033[0m\n' \\ sudo apt autoremove -y \\ # remove any orphaned package(s) dependencies \\ sudo apt clean \\ # clear apt cache \\ echo -e '\n\033[1;32m* All done.\033[0m\n' \\ soxbeep"

With the 1st change I get the > bash next line prompt which I don't know how to use in conjunction with my alias, so I Ctrl+z to exit out of it.
With the 2nd it errors at the first ( where it starts a print command.
I don't really know what I'm doing here (I'm not a bash ninja...yet lol) so I'm must not be formatting it correctly or I don't have enougth knowledge on the use of operators yet.

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

No branches or pull requests

2 participants