L6手机p2k软件文件传输seem修改应用(Ubuntu环境)

其它类软件,非上述版软件
回复
头像
a394474295
帖子: 33
注册时间: 2008-10-17 21:13

L6手机p2k软件文件传输seem修改应用(Ubuntu环境)

#1

帖子 a394474295 »

看网上帖子,综合成一个scripts,便于简单运用

参考http://www.motobbs.com/thread-447117-1-1.html

code如下,完成各种判断和软件下载设置。只需要运行下面的脚本就一切搞定了。

代码: 全选

#!bin/bash
#判断是否是ubuntu
echo "make sure your systerm is ubuntu"

#判断是否安装p2ktest
declare -i n=2
declare -i k=0
echo "k=$k"
for (( n=2 ; n<7 ;n=n+1 ))
do
m=`locate p2ktest | grep "bin" | grep "p2ktest" | cut -d "/" -f $n `
echo $m
	if [ "$m" = "p2ktest" ] ; then
		k=k+1
		echo "k=$k"
	fi
done

if [ "$k" > "0" ] ; then 
	echo "your systerm has p2ktest!"
else
	echo "there is no p2ktest,and now start to install p2ktest"
	echo "if you want to continue , type y "
	read yn

	if [ "$yn" = "y" ] || [ "$yn" = "Y" ] ; then 
		echo "continue"
	else 
		echo "exit"
		exit
	fi
	
	sudo apt-get install p2ktest
fi

#判断是否安装moto4lin
declare -i n=2
declare -i k=0
echo "k=$k"
for (( n=2 ; n<7 ;n=n+1 ))
do
m=`locate moto4lin | grep "bin" | grep "moto4lin" | cut -d "/" -f $n `
echo $m
        if [ "$m" = "moto4lin" ] ; then
                k=k+1
		echo "k=$k"
        fi
done

if [ "$k" > "0" ] ; then
        echo "your systerm has moto4lin!"
else
        echo "there is no p2ktest,and now start to install p2ktest"
        echo "if you want to continue , type y "
        read yn

        if [ "$yn" = "y" ] || [ "$yn" = "Y" ] ; then
                echo "continue"
        else
                echo "exit"
                exit
        fi

        sudo apt-get install moto4lin
fi

#判断是否有motorola_ve.options文件
if [ -f /etc/modprobe.d/motorola_ve.options ] ; then 
	echo "motorola_ve.options is ok"
else
	echo "motorola_ve.options should be created"

	获取uid和pid
echo ">>get uid and pid , waiting!"
uid=`lsusb | grep "Motorola" | cut -d " " -f 6 | cut -d ":" -f1`
pid=`lsusb | grep "Motorola" | cut -d " " -f 6 | cut -d ":" -f2`
echo "uid is $uid"
echo "pid is $pid"
#建立文件/etc/modprobe.d/motorola_ve.options
echo "creating /etc/modprobe.d/motorola_ve.options "
sudo echo "alias usb:v"$uid"p"$pid"* usbserial" > /etc/modprobe.d/motorola_ve.options
sudo echo "options usbserial vendor=0x$uid product=0x$pid" >> /etc/modprobe.d/motorola_ve.options
fi

#运行p2ktest
echo "run p2ktest"
sudo p2ktest
#运行moto4lin
echo "run moto4lin"
echo "now you can do what you want to do!"
sudo moto4lin
把上面代码保存为 p2kmoto.sh

运行命令:

代码: 全选

sudo bash p2kmoto.sh
附件
p2kmoto.tar.gz
p2kmoto.tar.gz
脚本
(992 Bytes) 已下载 34 次
头像
a394474295
帖子: 33
注册时间: 2008-10-17 21:13

Re: L6手机p2k软件文件传输seem修改应用(Ubuntu环境)

#2

帖子 a394474295 »

代码: 全选

#!/bin/bash
#这个文件主要用于ubuntu系统l6手机p2k软件的应用,传文件,修改seem
#made by xiaoyu 2009年 11月 25日
#判断是否是ubuntu
echo "make sure your systerm is ubuntu"

#判断是否安装p2ktest
m=`locate p2ktest | grep "bin" | grep "p2ktest"`
m=`echo ${m:(-7)}`
echo $m
if [ "$m" > "p2ktest" ] ; then 
	echo "your systerm has p2ktest!"
else
	echo "there is no p2ktest,and now start to install p2ktest"
	echo "if you want to continue , type y "
	read yn

	if [ "$yn" = "y" ] || [ "$yn" = "Y" ] ; then 
		echo "continue"
	else 
		echo "exit"
		exit
	fi
	
	sudo apt-get install p2ktest
fi

#判断是否安装moto4lin
m=`locate moto4lin | grep "bin" | grep "moto4lin"`
m=`echo ${m:(-8)}`
echo $m
if [ "$m" > "moto4lin" ] ; then
        echo "your systerm has moto4lin!"
else
        echo "there is no p2ktest,and now start to install p2ktest"
        echo "if you want to continue , type y "
        read yn

        if [ "$yn" = "y" ] || [ "$yn" = "Y" ] ; then
                echo "continue"
        else
                echo "exit"
                exit
        fi

        sudo apt-get install moto4lin
fi

#判断是否有motorola_ve.options文件
if [ -f /etc/modprobe.d/motorola_ve.options ] ; then 
	echo "motorola_ve.options is ok"
else
	echo "motorola_ve.options should be created"

	获取uid和pid
echo ">>get uid and pid , waiting!"
uid=`lsusb | grep "Motorola" | cut -d " " -f 6 | cut -d ":" -f1`
pid=`lsusb | grep "Motorola" | cut -d " " -f 6 | cut -d ":" -f2`
echo "uid is $uid"
echo "pid is $pid"
#建立文件/etc/modprobe.d/motorola_ve.options
echo "creating /etc/modprobe.d/motorola_ve.options "
sudo echo "alias usb:v"$uid"p"$pid"* usbserial" > /etc/modprobe.d/motorola_ve.options
sudo echo "options usbserial vendor=0x$uid product=0x$pid" >> /etc/modprobe.d/motorola_ve.options
fi

#运行p2ktest
echo "run p2ktest"
sudo p2ktest
#运行moto4lin
echo "run moto4lin"
echo "now you can do what you want to do!"
sudo moto4lin
修订文件是否存在判断
回复