!PTDeUFhQLrviJGtuht:matrix.org

Linux

668 Members
πŸ‡ΊπŸ‡¦πŸ‡ͺπŸ‡Ί | Talk about the GNU/HURD/Linux operating system and related stuff | be sensible, have nice discussions :) | oh, and https://dontasktoask.com | try not to become a help vampire, we have banhammers and wooden stakes: https://slash7.com/2006/12/22/vampires/ | DON'T USE KALI, IT'S FOR PENTESTING https://www.kali.org/docs/introduction/should-i-use-kali-linux/ | Manjarno https://manjarno.pages.dev/ | Virtualbox doesn't exist | Don't run GUI as superuser75 Servers

Load older messages


SenderMessageTime
1 Dec 2023
@growebis:matrix.orgHusseinberg changed their display name from Saad Goodman to Husseinberg.20:11:12
@growebis:matrix.orgHusseinberg changed their profile picture.20:11:22
@growebis:matrix.orgHusseinberg changed their profile picture.20:11:31
@enigma9o7:matrix.orgenigma9o7 anyone good at sed? I want a one-liner to edit /etc/default/grub that makes sure GRUB_DISABLE_OS_PROBER=false ; is there a way to do it so if there's already a GRUB_DISABLE_OS_PROBER line it makes sure it's not commented (remove # at beginning if exist) and if set to true, change it to false? 21:28:07
@enigma9o7:matrix.orgenigma9o7I'm at the point I think the easiest way is just delete any line with GRUB_DISABLE_OS_PROBER then just add the line I want.21:28:48
@enigma9o7:matrix.orgenigma9o7But I realize that's not the best way to do it....21:29:08
@iam_tj:matrix.orgiam_tj enigma9o7: echo "GRUB_DISABLE_OS_PROBER=yes" | sudo tee -a /etc/default/grub.d/local.cfg; sudo update-grub 21:33:52
@enigma9o7:matrix.orgenigma9o7that can end up with multiple lines21:35:54
@enigma9o7:matrix.orgenigma9o7that's just adding it, not editing it.21:36:01
@iam_tj:matrix.orgiam_tj Tip: *.cfg files in /etc/default/grub.d/take precedence and so avoid having to edit/etc/default/grub` 21:36:27
@enigma9o7:matrix.orgenigma9o7but yeah I'm at the point I think I'm just gunna use sed to remove existing line then add it back, could use tee like you said or just sed, either way. 21:36:30
@enigma9o7:matrix.orgenigma9o7I was just trying to figure out a sed command to edit it, instead of delete and add a line, but it really makes no difference, just annoying me i coudln't figure it out the way i originally tried21:36:46
@iam_tj:matrix.orgiam_tj Notice I'm not writing the package-shipped file; do not need to edit it with sed... just drop additional file(s) in /etc/default/grub.,d/*.cfg and they'll be sourceed after... order is lexical 21:38:51
@iam_tj:matrix.orgiam_tj * Tip: *.cfg files in /etc/default/grub.d/ take precedence and so avoid having to edit/etc/default/grub\ 21:39:30
@enigma9o7:matrix.orgenigma9o7 I'll just sudo sed -i '/OS_PROBER/d' /etc/default/grub first I guess. 21:39:45
@iam_tj:matrix.orgiam_tjThe issue with editing it is, if grub-common/grub2-common are updated the upgrade requires you to decide which version to keep - the package version or your edits. By dropping files in grub.d you can avoid that21:42:23
@iam_tj:matrix.orgiam_tj * Notice I'm not writing the package-shipped file; do not need to edit it with sed... just drop additional file(s) in /etc/default/grub.d/*.cfg and they'll be sourceed after... order is lexical 21:44:07
@iam_tj:matrix.orgiam_tj sed -i 's/^\(GRUB_DISABLE_OS_PROBER\)=\(.*\)/\1=false/' /etc/default/grub 21:48:34
@enigma9o7:matrix.orgenigma9o7
sudo sed -i '/OS_PROBER/d' /etc/default/grub
sudo sed -i -e '$aDISABLE_OS_PROBER=false' /etc/default/grub ```
21:48:50
@enigma9o7:matrix.orgenigma9o7is what i have now21:48:52
@enigma9o7:matrix.orgenigma9o7 *
sudo sed -i '/DISABLE_OS_PROBER/d' /etc/default/grub
sudo sed -i -e '$aDISABLE_OS_PROBER=false' /etc/default/grub
21:56:30
@enigma9o7:matrix.orgenigma9o7I think I'm just gunna stick with that; what you suggested doesn't deal with it if it's commented already.21:57:12
@enigma9o7:matrix.orgenigma9o7Making it a one-liner confuses me and wasting my time :)21:57:36
@iam_tj:matrix.orgiam_tjSo edit as appropriate; if it is commented then you need to match on the comment as well21:59:17
@iam_tj:matrix.orgiam_tj * sed -i 's/^#*\(GRUB_DISABLE_OS_PROBER\)=\(.*\)/\1=false/' /etc/default/grub 22:02:54
@enigma9o7:matrix.orgenigma9o7well the point is i want it to cover if its commented or not :)22:04:33
@enigma9o7:matrix.orgenigma9o7If there's a hash at the begin, remove it. if set to true, change to false.22:04:46
@enigma9o7:matrix.orgenigma9o7I'd rather have done the inplace editing so that it doesn't change the position of the line in the file, the solution I posted above just puts the new line at the end.22:05:15
@enigma9o7:matrix.orgenigma9o7 * I'd rather have done the inplace editing so that it doesn't change the position of the line in the file, the solution I posted above just deletes the old line and puts the new line at the end.22:05:30
@iam_tj:matrix.orgiam_tj I edited the one-liner to show how to match on a comment (or not) but not write a comment prefix22:06:15

There are no newer messages yet.


Back to Room ListRoom Version: 9