Skip to content
Snippets Groups Projects
Commit 0688d06e authored by Jiří Kalvoda's avatar Jiří Kalvoda
Browse files

PHONE Init

parent 4309e18e
No related branches found
No related tags found
No related merge requests found
#! /usr/bin/bash
cp phone ~/bin
chmod +x ~/phone/bin
#! /usr/bin/bash
cp sshd-start sshd-stop ~/../usr/bin/
chmod +x ~/../usr/sshd-start ~/../usr/sshd-stop
#!/bin/bash
getIP()
{
if [ "$1" = "" ]
then
ip=`cat ~/.phoneIP`
elif [ "$1" = "g" ]
then
ip=`ssh jirikalvoda@sneaky.kam.mff.cuni.cz -p80 "cat ~/.phoneIP"`
if [ $? = 0 ]
then
echo $ip > ~/.phoneIP
else
echo DOWNLOAD ERR! 1>&2
fi
else
ip=$1
fi
echo $ip 1>&2
echo $ip
}
if [ "$1" = "m" ];
then
ip=`getIP $2`
mkdir -p ~/phoneRoot
sshfs ~/phoneRoot $ip:/ -p8022
if [ "$?" = "0" ];
then
ln -s ~/phoneRoot/storage/emulated/0/ ~/phone
ln -s ~/phoneRoot/data/data/com.termux/files/home/ ~/phoneTermux
fi
fi
if [ "$1" = "t" ];
then
ip=`getIP $2`
ssh $ip -p8022
fi
if [ "$1" = "u" ];
then
unlink phone
unlink phoneTermux
umount ~/phoneRoot
rmdir phoneRoot
fi
if [ "$1" = "ip" ];
then
getIP $2
fi
#!/bin/bash
sshd;
ip=` ip addres | grep "global wlan0"| awk '{print $2}' | cut -d "/" -f 1`
echo $ip
echo $ip | diff ~/.phoneIP - > /dev/null
if [ $? -ne 0 ]
then
echo IP change from `cat ~/.phoneIP` to $ip
echo $ip | ssh jirikalvoda@sneaky.kam.mff.cuni.cz -p80 "cat > .phoneIP"
if [ $? = 0 ]
then
echo $ip > ~/.phoneIP
else
echo UPLOAD ERROR!
fi
fi
killall sshd
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment