Skip to content

Instantly share code, notes, and snippets.

@riywo
Created April 10, 2013 07:51
Show Gist options
  • Save riywo/5352652 to your computer and use it in GitHub Desktop.
Save riywo/5352652 to your computer and use it in GitHub Desktop.
$ pwd
/path/to/chroot
$ find . -type l -printf "%l\t%p\n" | grep '^/'
/etc/foo ./usr/local/etc/foo
$ find . -type l -printf "%l\t%p\n" | grep '^/' | ruby -F"\t|\n" -ane 'n=$F[1].split("/").size-2; org=Array.new(n, "..").join("/")+$F[0]; system "ln -sf #{org} #{$F[1]}"'
$ find . -type l -printf "%l\t%p\n"
../../../etc/hoge ./usr/local/etc/hoge
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment