〖Android〗超级终端/sdcard/local_profile备份

 1 # mode
 2 set -o vi
 3 
 4 # env
 5 workpc=work@11.11.137.171
 6 mepc=me@11.11.137.172
 7 passwd=/sdcard/passwd_me
 8 
 9 # ports of me@Power
10 adbdport=5514
11 sshdport=8814
12 
13 # alias
14 alias ls='busybox ls --color=auto'
15 alias l='ls -A'
16 alias la='ls -al'
17 alias ll='ls -lA'
18 alias mrw='mount -o remount,rw'
19 alias mro='mount -o remount,ro'
20 [ -e /sdcard/local_aliases ] && . /sdcard/local_aliases
21 
22 # functions
23 cdlink(){
24     cd $(readlink -f $1 || echo)
25 }
26 appbackup(){
27     mkdir -p /sdcard/app.scue
28     (cd /data/app && \
29     find . -type f -name \*.apk -exec cp {} /sdcard/app.scue \; &&\
30     echo '==> backup app done')
31 }
32 apprestore(){
33     (cd /sdcard/app.scue &&
34     find . -type f -name \*.apk -exec pm install {} \;
35     echo '==> restore app done')
36 }
37 ctmp(){
38     cd /data/local/tmp
39 }
40 cwork(){
41     ctmp
42 }
43 ucmount(){
44     mrw /
45     mkdir -p /sdcard/000
46     mount -o bind /sdcard/UCDownloads /sdcard/000 &&\
47     echo '==> done' ||\
48     echo '==> fail'
49     mro /
50 }
51 ucumount(){
52     umount /sdcard/000 && \
53     test -z "$(ls /sdcard/000)" && \
54     (rm -r /sdcard/000 
55     echo '==> done') || \
56     echo '==> fail'
57 }
58 ssh-copy-id(){
59     [ -z $1 ] && \
60     echo '==> remote not set, exit' && \
61     return 1
62     [ -e /data/.ssh/id_rsa.public ] &&\
63     (cat /data/.ssh/id_rsa.pub | ssh $1 \
64     'cat >> ~/.ssh/authorized_keys') && \
65     echo '==> done' && return 0
66     [ -e $HOME/.ssh/id_rsa.public ] &&\
67     (cat $HOME/.ssh/id_rsa.pub | ssh $1 \
68     'cat >> ~/.ssh/authorized_keys') && \
69     echo '==> done' && return 0
70     echo '==> error id_rsa.pub not found' && return 1
71 }
72 adbdserveron(){
73     setprop service.adb.tcp.port 5555
74     stop adbd
75     start adbd
76 }
77 adbdserveroff(){
78     setprop service.adb.tcp.port -1
79     stop adbd
80     start adbd
81 }
82 adbdsshr(){
83     ssh -N -f -R $sshdport:127.0.0.1:5555 $workpc
84 }
85 adbdquick(){
86     adbdserveron && adbdsshr
87 }
88 sshadbd(){
89     test x$(getprop service.adb.tcp.port) != x5555 &&\
90         adbdserveron
91     ssh -N -f -R $adbdport:127.0.0.1:5555 $mepc
92     ssh -N -f -R $sshdport:127.0.0.1:2222 $mepc
93 }

 

posted @ 2014-07-15 09:58  scue  阅读(1475)  评论(0编辑  收藏  举报