my_pandoc.sh 921 Bytes
Newer Older
is151014's avatar
is151014 committed
1 2 3 4 5 6 7 8 9
#!/bin/bash

if [ $# -ne 2 ] ; then
	echo "please give me 2 parameters:"
	echo "    Directory relative to your Home-Path"
	echo "    Your username"
	exit 1
fi

is151014's avatar
is151014 committed
10 11 12
echo "path: $1"
echo "user: $2"

is151014's avatar
is151014 committed
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
username="$2"
priv_key="$HOME/.ssh/keygen"
mp="$HOME/FH/"

startdir="$(pwd)"
if [ ! -e $priv_key ] ; then
	echo "generate key"
	ssh-keygen -b 16384 -f $priv_key
	ssh-copy-id -i "$priv_key.pub" "$username@gate01.remote.lab"
fi

if [ ! -e $mp ] ; then
	mkdir $mp
fi

is151014's avatar
is151014 committed
28 29
fusermount -u $mp 2> /dev/null || true
#echo sshfs $username@gate01.remote.lab $mp -o sync_readdir -o sshfs_sync -o reconnect
is151014's avatar
is151014 committed
30 31
sshfs $username@gate01.remote.lab:/home/$username $mp -o sync_readdir -o sshfs_sync -o reconnect -o IdentityFile=$priv_key

is151014's avatar
is151014 committed
32
unlink $mp/$1/Makefile 2> /dev/null || true
is151014's avatar
is151014 committed
33 34 35 36 37 38
ln -s $HOME/TEMPLATES/Makefile $mp/$1/Makefile
cd $mp/$1
make
unlink $mp/$1/Makefile || true
sync
cd $startdir
is151014's avatar
is151014 committed
39
fusermount -u $mp || sudo umount $mp 2> /dev/null || true