cloudymax / pxeless

An automated system install and image customization tool for when PXE is not an option, or is not an option yet.
MIT License
108 stars 16 forks source link

Make sudo conditional to user/env #36

Open ToroNZ opened 1 year ago

ToroNZ commented 1 year ago

Noticed that this function was expanded quite a bit and "sudo" is now a dependency (which broke CI builds for me in Bitbucket). Perhaps we could make sudo optional if not running as root or in CI runners?... like:

#!/bin/bash
if [ ! "$CI" ]; then
  if [ "$USER" != "root" ]; then
    SUDO="sudo "
  fi
fi

I've had a quick look and they seem to be related to #27 . Though I never had issues adding extra files in Ubuntu Focal (20.04). So there must be something more to it... I hope to dig a little bit deeper on the following days, for now I will lock this submodule to the previous commit.

BTW - Kudos @cloudymax for maintaining this tool :)

https://github.com/cloudymax/pxeless/blob/d814df00b4df248f5070f857fd6ffc304729ebb0/image-create.sh#L387-L398

cloudymax commented 1 year ago

Thanks for the kind words as well as letting me know the changes cased issues with your flow, ill definitely need to do some testing to sort out a solution for user/group/root/sudo permissions.

I think part of the problem is that 20.04 is the last version before the switch to the new ISO creation process using El troito, but I was unable to get the previous extra files method to work on 22.04.

Could you share how your running the command for 20.04 so I can try to get in-sync with how you're using the tool?

Work has been very hectic this month so I apologize for the delayed reply 🙏