Skip to content
This repository has been archived by the owner on Mar 2, 2020. It is now read-only.

Commit

Permalink
added support for .dontlink markers
Browse files Browse the repository at this point in the history
  • Loading branch information
toothbrush committed Apr 19, 2012
1 parent b1c2a98 commit a010273
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/DotFS.hs
Expand Up @@ -57,7 +57,7 @@ printScript mountpoint (C confdir) = concat (intersperse "\n"
, "# Will not overwrite files or directories, but will update"
, "# symlinks, if found."
, "#"
, "# (c) Paul van der Walt, March 2012"
, "# (c) Paul van der Walt, April 2012"
, ""
, "home=$HOME"
, "confdir=\"" ++ confdir ++ "\""
Expand All @@ -68,7 +68,7 @@ printScript mountpoint (C confdir) = concat (intersperse "\n"
, "do"
, " # skip the breadcrumbs"
, " # skip .git too, since it makes shit way slow"
, " if [ \"$i\" = \".\" ] || [ \"$i\" = \"..\" ] || [ \"$i\" = \".git\" ] ; "
, " if [ \"$i\" = \".\" ] || [ \"$i\" = \"..\" ] || [ \"$i\" = \".git\" ] || [ \"${i##*.}\" = \"dontlink\" ]; "
, " then "
, " continue"
, " fi"
Expand All @@ -78,6 +78,7 @@ printScript mountpoint (C confdir) = concat (intersperse "\n"
, " # note that preserving the tree structure here"
, " # happens automatically, since `ls` only goes 1 deep."
, " target=\"$mountpoint/$i\""
, " target_orig=\"$confdir/$i\""
, " if [ -L \"$newsource\" ] ; # -L <=> exists and is symlink"
, " then"
, " # rm old link"
Expand All @@ -88,11 +89,12 @@ printScript mountpoint (C confdir) = concat (intersperse "\n"
, " # in the case of directories, it thinks the newsource is"
, " # WHERE you'd like the link, i.e. you get stuff like:"
, " # `~/.somefolder/.somefolder` -> `mountpoint/.somefolder`"
, " if [ -e \"$newsource\" ] ; # -e <=> file exists"
, " then"
, " echo \"Skipping $newsource.\""
, " continue"
, " fi"
, " echo ln -s -v \"$target\" \"$newsource\""
, " echo \"if [ ! -e \"$newsource\" ] ; then # -e <=> file exists\""
, " echo \" if [ -e \"$target_orig.dontlink\" ] ; then\""
, " echo \" ln -s -v \"$target_orig\" \"$newsource\"\""
, " echo \" else\""
, " echo \" ln -s -v \"$target\" \"$newsource\"\""
, " echo \" fi\""
, " echo \"fi\""
, "done"
])

0 comments on commit a010273

Please sign in to comment.