From aee0a149662d513638ccaa66570de2d0f4bd6914 Mon Sep 17 00:00:00 2001 From: Michael Raitza Date: Sun, 9 Oct 2022 14:02:30 +0200 Subject: [PATCH] X-Plane improve Navdata updates --- x-plane/default.nix | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/x-plane/default.nix b/x-plane/default.nix index 24da77a..fb69189 100644 --- a/x-plane/default.nix +++ b/x-plane/default.nix @@ -141,6 +141,8 @@ let elif [ -e "$XPLANEPATH/Custom Data/cycle_info.txt" ]; then oldcycle=$(head -n1 "$XPLANEPATH/Custom Data/cycle_info.txt" | sed -E -n -e "s/^AIRAC cycle[ :]+([0-9]+)\r$/\1/p") [ -n "$oldcycle" ] || { printf "Unable to determine old AIRAC cycle\n" >&2; exit 1; } + else + oldcycle= fi f=$1 [ -e "$f" ] || { printf "No such file or directory\n" >&2; exit 1; } @@ -148,7 +150,9 @@ let cycle=''${cycle%.zip} newpath="$XPLANEPATH/Custom Data AIRAC$cycle" - if [ ! -h "$XPLANEPATH/Custom Data" ]; then + if [ -z "$oldcycle" ]; then + rm -r "$XPLANEPATH/Custom Data" + elif [ ! -h "$XPLANEPATH/Custom Data" ]; then mv "$XPLANEPATH/Custom Data" "$XPLANEPATH/Custom Data AIRAC$oldcycle" fi @@ -173,7 +177,7 @@ let Also, you can place the FAACIFP18 file here, which you can get from the FAA website: https://www.faa.gov/air_traffic/flight_info/aeronav/digital_products/cifp/ If the file FAACIFP18 is found in this folder, X-Plane will load instrument flight procedures from this file. EOF - rm "$XPLANEPATH/Custom Data" + rm -f "$XPLANEPATH/Custom Data" ln -sf "$newpath" "$XPLANEPATH/Custom Data" '';