Skip to content

Instantly share code, notes, and snippets.

@BANOnotIT
Last active May 14, 2017 08:21
Show Gist options
  • Save BANOnotIT/16a8976164adcd4e6025d116645bdd08 to your computer and use it in GitHub Desktop.
Save BANOnotIT/16a8976164adcd4e6025d116645bdd08 to your computer and use it in GitHub Desktop.
#!/usr/bin/perl
# Usage:
# $ echo -e "[email protected] pass1\[email protected] pass2" \
# | ./mhddfs.example.pl
$marcfs='/path/to/marcfs/binary';
$dest_dir='/path/to/destination/dir/';
$home = $ENV{"HOME"};
print "[+] Adding needed dirs and mount marcfs...\n";
system("mkdir -p $dest_dir");
$i = 0;
while(<STDIN>) {
chomp;
$i = $i + 1;
($login, $pass) = split(/ /, $_, 2);
system("mkdir -p /tmp/marcfs/cloud$i $home/mnt/MARC_mount_$i");
system("$marcfs $home/mnt/MARC_mount_$i -o username=$login,password=$pass,cachedir=/tmp/marcfs/cloud$i/");
}
print "[+] Concatting marcfs into dest_dir ($dest_dir)...\n";
$paths = join(",", map {"$home/mnt/MARC_mount_$_"} (1..$i));
system("mhddfs $paths $dest_dir");
print "[+] All done!\n";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment