Commit Graph

10 Commits

Author SHA1 Message Date
Brett Milford a0d1a1f78c Update contrib/nuke-graph-directory.sh
Signed-off-by: Brett Milford <brettmilford@gmail.com>
2021-04-09 10:05:35 +10:00
Brett Milford 398cb1dc4f Fixes subvol delete on a non-btrfs volume
Inode numbers are guaranteed to be unique only within a filesystem.
As such there is an edge case where these predicates are true on a
non-btrfs filesystem.

Closes #42271

Signed-off-by: Brett Milford <brettmilford@gmail.com>
2021-04-08 12:09:23 +10:00
Akihiro Suda 3cf82748dd run shfmt
git grep --name-only '^#!' | egrep -v '(vendor|\.go|Jenkinsfile)' | xargs shfmt -w -bn -ci -sr

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2020-03-03 12:27:49 +09:00
Tianon Gravi 52379fa76d Convert script shebangs from "#!/bin/bash" to "#!/usr/bin/env bash"
This is especially important for distributions like NixOS where `/bin/bash` doesn't exist, or for MacOS users who've installed a newer version of Bash than the one that comes with their OS.

Signed-off-by: Andrew "Tianon" Page <admwiggin@gmail.com>
2017-02-13 11:01:54 -08:00
Jess Frazelle 026b710879
change sh to bash for shopt
Signed-off-by: Jess Frazelle <acidburn@google.com>
2017-01-27 12:16:40 -08:00
Bruno Tavares 5f98b97749 Nuke when graphdir is a mount
Previously, when the graphdir was a root of a mountpoint, we would not
be able to cleanup the graphdir, as the script would umount in case
target dir is a mount itself

```/etc/mtab
/dev/xvdc1 /var/lib/docker btrfs
```

When running the script, the graphdir would be unmounted and it would
remove a (possibly) empty folder.

```
Nuking /var/lib/docker ...
  (if this is wrong, press Ctrl+C NOW!)

  + sleep 10

  + umount -f /var/lib/docker
  + rm -rf /var/lib/docker
  ```

This PR includes the necessary changes to nuke the folder on this
scenario, including when the graphdir is a btrfs mount iself.

Signed-off-by: Bruno Tavares <btavare@thoughtworks.com>
2016-11-01 22:22:25 -02:00
Adam Mills c3aa75c5a7 nuke-graph-directory.sh: Improve subvolume search
This change allows btrfs subvolumes to be found in additional system
configurations. The old logic failed to correctly identify subvolumes
when the root fs was mounted as a subvolume that was not the btrfs
filesystem root.

Signed-off-by: Adam Mills <adam@armills.info>
2016-08-08 13:00:21 -04:00
Joe Ferguson d2e9f6c0c1 Fix nuke script to remove from end of path
Signed-off-by: Joe Ferguson <joe@infosiftr.com>
2015-09-09 15:34:05 -07:00
Tianon Gravi 6b340e391c Fix a bashism and some minor bugs in nuke-graph-directory.sh
Signed-off-by: Andrew Page <admwiggin@gmail.com>
2014-12-12 11:51:12 -07:00
Tianon Gravi 047ce47d92 Add contrib/nuke-graph-directory.sh script to clean out old /var/lib/docker directories much more easily
Signed-off-by: Andrew Page <admwiggin@gmail.com>
2014-08-05 12:36:39 -06:00