Showing 1 changed files with 14 additions and 7 deletions
+14 -7
flightgear/fgfs_function
... ...
@@ -189,11 +189,18 @@ function fgfs () {
189 189
                 local candidate_airport=${fgfs_arg%:*}; [[ $candidate_airport == $fgfs_arg ]] && candidate_airport=${fgfs_arg%+*}
190 190
                 local candidate_parking=${fgfs_arg#*:}; [[ $candidate_parking == $fgfs_arg ]] && unset candidate_parking
191 191
                 local candidate_runway=${fgfs_arg#*+};  [[ $candidate_runway  == $fgfs_arg ]] && unset candidate_runway
192
-                local terrafs=${candidate_airport#-}
193 192
 
194
-                if [[ $terrafs != $candidate_airport && -x $HOME/.fgfs/terrafs && -d $HOME/.fgfs/terrafs.d ]]; then
195
-                    candidate_airport=$terrafs
196
-                    $HOME/.fgfs/terrafs $HOME/.fgfs/terrafs.d
193
+                if [[ -x $HOME/.fgfs/terrafs && -d $HOME/.fgfs/terrafs.d ]]; then
194
+                    if test $(grep -Ec "^terrafs\s+$HOME/.fgfs/terrafs.d" /proc/mounts) -eq 0 \
195
+                    && echo "$HOME/.fgfs/terrafs.d present but not mounted !"                 \
196
+                    && test -x $HOME/.fgfs/mount.terrafs                                      \
197
+                    && read -q "mount_terrafs?go to mount it ? (y/N) "                        \
198
+                    && [[ "${mount_terrafs:-n}" = "y" ]]; then
199
+                        $HOME/.fgfs/mount.terrafs || return 1
200
+                    else
201
+                        echo "mount it manually, or remove it to use TerraSync"
202
+                        return 1
203
+                    fi
197 204
                     fgfs_args+=(--fg-scenery=$HOME/.fgfs/terrafs.d)
198 205
                     fgfs_args+=(--disable-terrasync)
199 206
                     local scenes_dir=$HOME/.fgfs/terrafs.d
... ...
@@ -703,8 +710,8 @@ EOH
703 710
     export ${DISCRETE_GPU[@]}
704 711
     $FGDIR/install/flightgear/bin/fgfs ${fgfs_args[@]}
705 712
     unset fgfs_args ${DISCRETE_GPU[@]%=*}
706
-    
707
-    if grep -q $HOME/.fgfs/terrafs.d /proc/mounts; then
708
-        fusermount -u $HOME/.fgfs/terrafs.d
713
+
714
+    if test ${mount_terrafs:-n} = y; then
715
+        $HOME/.fgfs/mount.terrafs
709 716
     fi
710 717
 }