Advertisement
zixaphir

create_virtual_directories.sh

Aug 3rd, 2022
1,430
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.51 KB | None | 0 0
  1. #!/bin/bash
  2. # create_virtual_directories.sh
  3.  
  4. # Mod Organizer configuration file for mod install order
  5. modlist='/home/zixaphir/Games/mod-organizer-2/ModOrganizer2/profiles/Default/modlist.txt'
  6.  
  7. # Directory containing mods, each mod is a subdirectory
  8. modsdir='/home/zixaphir/Games/mod-organizer-2/ModOrganizer2/mods/'
  9.  
  10. # Directory containing original Skyrim data folder
  11. # Renamed because I'm not sure OverlayFS can mount over existing data?
  12. dirs='/home/zixaphir/Games/SteamLibrary/steamapps/common/Skyrim Special Edition/Data_orig/'
  13.  
  14. # Read the modslist. Enabled mods are the directory names, prefixed with a
  15. # symbol, `#` meaning unmanaged, `*` meaning disabled,  and `+` meaning
  16. # enabled. We look for the `+`, parse it out, and then assemble a list
  17. # of directories to use. The modslist uses windows line endings, so those
  18. # have to be trimmed with sed.
  19. while read -r line; do
  20.     if [[ $line =~ ^\+ ]]; then
  21.         dirs="${dirs}:$modsdir$(echo $line | sed s/\+// | sed s/\\r//)"
  22.     fi;
  23. done < $modlist
  24.  
  25. # Mount the virtual filesystem, using Mod Organizer's `overwrite` directory
  26. # as the top level, where all changes to the virtual directory should be
  27. # dumped. The workdir must be an empty directory that exists on the same
  28. # host filesystem as the upperdir!!
  29. sudo mount -t overlay overlay -o \
  30. lowerdir="$dirs",\
  31. upperdir="/home/zixaphir/Games/mod-organizer-2/ModOrganizer2/overwrite",\
  32. workdir="/home/zixaphir/Games/vfs_working" \
  33. "/home/zixaphir/Games/SteamLibrary/steamapps/common/Skyrim Special Edition/Data/"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement