@@ -12,6 +12,32 @@ mountpoint -q /home/user/; HOME_USER_MOUNTED=$?
12
12
STOW_COMPLETE=/home/user/.stow_completed
13
13
14
14
if [ $HOME_USER_MOUNTED -eq 0 ] && [ ! -f $STOW_COMPLETE ]; then
15
+ # There may be regular, non-symlink files in /home/user that match the
16
+ # pathing of files in /home/tooling. Stow will error out when it tries to
17
+ # stow on top of that. Instead, we can append to the current
18
+ # /home/tooling/.stow-local-ignore file to ignore pre-existing,
19
+ # non-symlinked files in /home/user that match those in /home/tooling before
20
+ # we run stow.
21
+ #
22
+ # Create two text files containing a sorted path-based list of files in
23
+ # /home/tooling and /home/user. Cut off "/home/user" and "/home/tooling" and
24
+ # only get the sub-paths so we can do a proper comparison
25
+ #
26
+ # In the case of /home/user, we want regular file types and not symbolic
27
+ # links.
28
+ find /home/user -type f -xtype f -print | sort | sed ' s|/home/user||g' > /tmp/user.txt
29
+ find /home/tooling -print | sort | sed ' s|/home/tooling||g' > /tmp/tooling.txt
30
+ # We compare the two files, trying to find files that exist in /home/user
31
+ # and /home/tooling. Being that the files that get flagged here are not
32
+ # already synlinks, we will want to ignore them.
33
+ IGNORE_FILES=" $( comm -12 /tmp/user.txt /tmp/tooling.txt) "
34
+ # We no longer require the file lists, so remove them
35
+ rm /tmp/user.txt /tmp/tooling.txt
36
+ # For each file we need to ignore, append them to
37
+ # /home/tooling/.stow-local-ignore.
38
+ for f in $IGNORE_FILES ; do echo " ${f} " >> /home/tooling/.stow-local-ignore; done
39
+ # We are now ready to run stow
40
+ #
15
41
# Create symbolic links from /home/tooling/ -> /home/user/
16
42
stow . -t /home/user/ -d /home/tooling/ --no-folding -v 2 > /tmp/stow.log 2>&1
17
43
# Vim does not permit .viminfo to be a symbolic link for security reasons, so manually copy it
0 commit comments