]> arthur.barton.de Git - netatalk.git/blobdiff - contrib/shell_utils/apple_dump.in
apple_dump: Extended Attributes AppleDouble support for *BSD
[netatalk.git] / contrib / shell_utils / apple_dump.in
index f5dab45128cf064d97c90fced979991294795999..e207151d5c3f1d625a1e7ac953f21efc3a3859b7 100755 (executable)
@@ -59,6 +59,8 @@ if (     0 == system("which getfattr > /dev/null 2>&1")) {
     $eacommand = 2;
 } elsif (0 == system("which runat > /dev/null 2>&1")) {
     $eacommand = 3;
+} elsif (0 == system("which getextattr > /dev/null 2>&1")) {
+    $eacommand = 4;
 } else {
     $eacommand = 0;
 }
@@ -873,6 +875,17 @@ sub checkea {
         }
         close (EALIST);
         return 0;
+    } elsif ( $eacommand == 4 ) {
+        open(EALIST, "lsextattr -q user \"$file\" |");
+        while(<EALIST>) {
+            $_ = "\t".$_;
+            if ( $_ =~ /\torg\.netatalk\.Metadata[\n\t]/ ) {
+                close (EALIST);
+                return 1;
+            }
+        }
+        close (EALIST);
+        return 0;
     } else {
         return 0;
     }
@@ -893,6 +906,8 @@ sub eaopenfile {
         system("attr -q -g org.netatalk.Metadata \"$file\" > $eatempfile");
     } elsif ( $eacommand == 3 ) {
         system("runat \"$file\" cat org.netatalk.Metadata > $eatempfile");
+    } elsif ( $eacommand == 4 ) {
+        system("getextattr -q user org.netatalk.Metadata \"$file\" > $eatempfile");
     } else {
         return "";
     }