Skip to content

Instantly share code, notes, and snippets.

@porteusconf
Last active August 13, 2024 02:26
Show Gist options
  • Save porteusconf/7b5a0d689c8af1a7702c5440ea37f47c to your computer and use it in GitHub Desktop.
Save porteusconf/7b5a0d689c8af1a7702c5440ea37f47c to your computer and use it in GitHub Desktop.
in dev mode on ChromeOS, backup and restore chromebrew (crew) and non-crew, that is manually installed items, in /use/local/bin

How I backup/restore my chromebrew setup and manually-installed items in /usr/local/bin by using group

In dev mode chromeos, most mounts are noexec except /usr/local so that is why executeables are in /usr/local/bin Almost everything in my /usr/local was installed by chromebrew (crew) except a few items I manually copied to /usr/local/bin

As a way to tag items I manually added, I change the group from chronos to some other group and I chose midis which seems safe. So for example, I like to keep a non-executeable list of what crew has installed in /usr/local/bin

crew list installed > /usr/local/bin/crew-list-installed.txt

I also sometimes manually install in /usr/local/bin some *.sh or a few binaries crew does not (yet) provide, like btm. To identify non-crew-provided items, we can change the group from chronos to midis

chgrp  midis          /usr/local/bin/crew-list-installed.txt

So to make a tarball of my stuff identified by group midis in /usr/local/bin I just do a fine ./bin -group midis

cd /usr/local; find ./bin -group midis -print0 | tar -cvf /tmp/bin.tar  --null -T -

echo " To restore what crew had installed:   crew install $(cat /usr/local/bin/crew-list-installed.txt) "

$ cd /tmp; tar -xvf /tmp/bin.tar --same-owner  #   --same-owner restores midis group
chronos@localhost /tmp $ ls -l ./bin
total 21908

-rwxr-xr-x. 1 chronos midis      606 Jul 25 09:43 batinfo.sh
-rwxr-xr-x. 1 chronos midis      293 Jul  1 13:52 brav.sh
-rwxr-xr-x.   1 chronos midis    4723536 Aug 26  2023 btm
-rwxr-xr-x. 1 chronos midis       86 Jul 26 16:40 btopweb.sh
-rw-r--r--. 1 chronos midis     9426 Aug 12 21:54 crew-list-installed.txt
-rwxr-xr-x. 1 chronos midis       84 Aug 12 12:13 disable_cros_updates.sh
-rwxr-xr-x. 1 chronos midis  5587072 Jul 25 10:16 sampler
-rwxr-xr-x. 1 chronos midis 15461709 Jul 23 16:03 smartctl_exporter
-rwxr-xr-x. 1 chronos midis  1362040 Jul 26 16:33 ttyd

# If all looks ok in /tmp/bin just you can resore by just  mv /tmp/bin/*  /usr/local/bin

TL/DR: create a tarball that has a list of what crew installed, and other files crew did NOT install to /usr/local/bin Keep tarball in a safe place and you can restore you stuff, and/or copy crew/custom-file setup to another chromeos[flex] box.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment