/system/su.d - SuperSU

Hello. I found same questions in other topics, but couldn't find answer.
I would like run script from /system/su.d folder:
Code:
#!/system/bin/sh
echo 0 > /sys/fs/selinux/enforce
or
Code:
#!/system/bin/sh
setenforce 0
and I even tried to run test script:
Code:
#!/system/bin/sh
touch /data/local/tmp/test.txt
echo "test" >> /data/local/tmp/test.txt
But no one of them works. I tried different names for files, gave different chmod (644,700,755). Nothing helps me to run script.
Mb somebody can give me advice what's problem can be?
Phone: Xperia Z3c, MM, systemless SuperSU
On other phone (Xperia M5) this all works fine.

I have a the same problem with a different file in /system/su.d,
Code:
#!/system/bin/sh
logfile0=/data/local/tmp/exfat_mount.log
#logfile=$logfile0
logfile=/dev/null
if [ -e $logfile0 ]; then
logfile=$logfile0
fi
echo '******' $(date) '******' >> $logfile
echo 'id: ' $(id) >> $logfile 2>&1
if [ x$SECONDARY_STORAGE == x ]; then
SECONDARY_STORAGE=/storage/sdcard1
fi
device=/dev/block/mmcblk1p1
echo "Starting for $device" >> $logfile
while read line; do
words=($line)
if [ ${words[0]} == $device ]; then
echo "Error: $device already mounted:" >> $logfile
echo "$line" >> $logfile
exit 1
fi
if [ ${words[1]} == $SECONDARY_STORAGE ]; then
echo "Error: SECONDARY_STORAGE already in use:" >> $logfile
echo "$line" >> $logfile
exit 1
fi
done < /proc/mounts
binpath=/system/xbin
probe=$binpath/probe
if [ ! -e $probe ]; then
echo "Error: $probe not found!" >> $logfile
exit 1
fi
FS=($($probe $device))
echo "$device file system:" ${FS[0]} >> $logfile
# ***** Setup tools for different file systems:
if [ ${FS[0]} == "exFAT" ]; then
echo "$device is exFAT" >> $logfile
mount=$binpath/mount.exfat
if [ -f $mount ]; then
links=( "mkfs.exfat" "fsck.exfat" "dumpexfat" "exfatfsck" "exfatlabel" "mkexfatfs" "mount.exfat-fuse" )
for l in "${links[@]}"
do
if [ ! -e $binpath/$l ]; then
mount -o remount,rw /
ln -s $mount $binpath/$l
echo "Created symlink $binpath/$l" >> $logfile
fi
done
fi
fsck=$binpath/exfatfsck
fsck_ops=
elif [ ${FS[0]} == "NTFS" ]; then
echo "$device is NTFS" >> $logfile
mount=$binpath/ntfs-3g
fsck=$binpath/ntfsfix
fsck_ops='-n'
else
echo "Error: $device is not supported!" >> $logfile
exit 1
fi
# ***** Check if we have required tools.
if [ ! -e $mount ]; then
echo "Error: $mount not found!" >> $logfile
exit 1
fi
if [ ! -e $fsck ]; then
echo "Error: $fsck not found!" >> $logfile
exit 1
fi
# ***** Mount for rw only if the file system is not damaged.
options_ro="ro,uid=1023,gid=1023,umask=0000"
options_rw="rw,uid=1023,gid=1023,umask=0000,noatime"
mnt_cmd="$mount -o $options_rw $device /mnt/media_rw/sdcard1"
$fsck $fsck_ops $device >> $logfile 2>&1
if [ $? != 0 ]; then
mnt_cmd="$mount -o $options_ro $device /mnt/media_rw/sdcard1"
fi
echo "$mnt_cmd" >> $logfile
if [ -e /sys/fs/selinux/enforce ]; then
if [ -e /system/xbin/supolicy ]; then
# ***** Set permissions for fuse. Instead, our mounts would be RO for others.
echo "Using supolicy to provide permissions to fuse." >> $logfile
/system/xbin/supolicy --live "allow sdcardd unlabeled dir { append create execute write relabelfrom link unlink ioctl getattr setattr read rename lock mounton quotaon swapon rmdir audit_access remove_name add_name reparent execmod search open }"
/system/xbin/supolicy --live "allow sdcardd unlabeled file { append create write relabelfrom link unlink ioctl getattr setattr read rename lock mounton quotaon swapon audit_access open }"
/system/xbin/supolicy --live "allow unlabeled unlabeled filesystem associate"
/system/xbin/supolicy --live "allow sdcardd unlabeled filesystem { getattr mount remount unmount }"
/system/xbin/supolicy --live "allow vold unlabeled filesystem { getattr mount remount unmount }"
/system/xbin/supolicy --live "allow init unlabeled filesystem { getattr mount remount unmount }"
else
# ***** Turn SELinux to Permissive. Instead, our mounts would be RO for others.
echo "Using setenforce 0 to provide permissions to fuse." >> $logfile
setenforce 0
fi
fi
# ***** Try to mount:
if [ 0 != 0 ]; then
$mount -o $options_rw $device $SECONDARY_STORAGE
echo "Mounted directly" >> $logfile
else
mount -o remount,rw /system
rm -f /system/bin/debuggerd.mine
echo '#!/system/bin/sh' > /system/bin/debuggerd.mine
echo "$mnt_cmd" >> /system/bin/debuggerd.mine
echo 'start fuse_sdcard1' >> /system/bin/debuggerd.mine
chmod 777 /system/bin/debuggerd.mine
stop debuggerd
mv /system/bin/debuggerd /system/bin/debuggerd.its
mv /system/bin/debuggerd.mine /system/bin/debuggerd
start debuggerd
sleep 2
stop debuggerd
mv /system/bin/debuggerd /system/bin/debuggerd.mine
mv /system/bin/debuggerd.its /system/bin/debuggerd
start debuggerd
mount -o remount,ro /system
vdc volume mount $SECONDARY_STORAGE
echo "Mounted via debuggerd" >> $logfile
fi
The file is called 00mountsd and is used to give access to exfat microsd on stock android 5.1 running on a Chuwi Hi10pro tablet with cherry trail z8350 cpu. I used this on a previous version of the tablet and it worked fine although that tablet came with RemixOS.
The file runs without errors when run manually and succeeds at it task
ls -lZ returns this -rwxr-xr-x root root u: object_r:system_file:s0 00mountsd
I'm running SuperSU Free v2.79 everything else works fine.
Any ideas?

Related

[Solved]Help to mount SDcard

Hi I built a little script to mount my SDcard @ startup of the phone and install some apps.
here it is:
Code:
sleep 2
busybox mount > /data/mount.txt
busybox ls /dev/block/vold >> /data/mount.txt
busybox mount -t vfat -o rw,dirsync,nosuid,nodev,noexec,uid=1000,gid=1015,fmask=0702,dmask=0702,allow_utime=0020,shortname=mixed,utf8 /dev/block/vold/179:1 /sdcard >> /data/mount.txt
busybox mount >> /data/mount.txt
sleep 3
echo "APPS installation"
if [ -e /sdcard/Apps-install/install.txt ];
then
echo "found file" > /sdcard/Apps-install/install.txt
cd /sdcard/Apps-install
ls *.apk > ./apps.txt
for line in $(cat apps.txt); do install -c -D /sdcard/Apps-install/"$line" /data/app >> /sdcard/Apps-install/install.txt; done
echo "ok" >> /sdcard/Apps-install/install.txt
else
echo "file not found" > /sdcard/Apps-install/install.txt
fi;
sleep 2
echo "Finish"
if [ -e /data/firstboot.sh ];
then
busybox rm -f /data/firstboot.sh;
busybox rm -f /sdcard/Apps-install/apps.txt;
fi;
echo "Restart"
sleep 1
reboot
I'm sure that the code is well executed (as is have data in /data/mount.txt) but the mount of the SD and so every work related to the SD
What is strange is that script work if i execute it after the phone has completely started.
Can someone help please.
Bye
Herc.8)
A Little up for a little help
Hi,
I still need help,
thx by advance
Bye
Herc. 8)
Ok finally found bye myself.
I changed the device: /dev/block/vold/179:1 for /dev/block/mmcblk0p1
That's all.
Bye
Herc. 8)

[Q] how to move dalvik-cache to ext in cm7.1.0 RC5 11.05.20?

milestone 1 on cm7 0.08-11.04.24 7.0.1 , i have one ext3 partition on my sdcard, everything was working fine,
but after upgrading to cm7.1.0 RC0 11.05.03 yesterday , i can't move the dalvik-cache to ext partition any longer.
even if i do this
mv /data/dalvik-cache /sddata/dalvik-cache
ln -s /sd-ext/dalvik-cache/ /data/dalvik-cache
next time phone reboots, it delete my link and create dalvik-cache directory in "internal storage" while not on my ext3 partition
when i boot into OR 3.3 , the ext3 partition is mounted as /sddata
if i boot into phone ui, the ext3 partition is mounted as /sd-ext
i tiried linking to both directory , none of them works
anyone knows how to do it ?
[edit] after updating to 7.1.0 RC5 11.05.20, the file update-07app2ext-dalvik.on.ext.zip provided by zeppelin doesn't work , ahhhhh.
You will need to edit the 07app2ext file in /system/etc/init.d
Yep.
I did this yesterday actually since my internal storage was getting too low for my liking.
From github, the earlier 07app2ext:
Code:
#!/system/bin/sh
if [ "$SD_EXT_DIRECTORY" = "" ];
then
SD_EXT_DIRECTORY=/sd-ext
fi
if [ "`egrep -q $SD_EXT_DIRECTORY /proc/mounts;echo $?`" != "0" ];
then
echo "$SD_EXT_DIRECTORY not mounted.. skipping a2sd"
exit
fi
for dir in app app-private dalvik-cache;do
if [ "`egrep -q \"/data/${dir}\" /proc/mounts;echo $?`" != "0" ];
then
if [ ! -e "${SD_EXT_DIRECTORY}/${dir}" ];
then
install -m 771 -o 1000 -g 1000 -d ${SD_EXT_DIRECTORY}/${dir}
fi
if [ -L "/data/${dir}" ];
then
rm /data/${dir}
install -m 771 -o 1000 -g 1000 -d /data/${dir}
fi
if [ "${dir}" = "dalvik-cache" ];
then
if [ ! -L "/data/${dir}" ];
then
rm -rf /data/${dir}
install -m 771 -o 1000 -g 1000 -d /data/${dir}
fi
fi
if [ "${dir}" = "app" -o "${dir}" = "app-private" ];
then
for app in `find /data/${dir} -type f -iname "*.apk" -o -iname "*.zip"`;do
mv ${app} ${SD_EXT_DIRECTORY}/${dir}/
done
fi
mount -o bind ${SD_EXT_DIRECTORY}/${dir}/ /data/${dir}
fi
done
chmod 755 /system/etc/init.d/07app2ext
chown -R 0.2000 /system/etc/init.d
sleep 1
I just started using s2e from the market, its working so far
zeppelinrox said:
Yep.
I did this yesterday actually since my internal storage was getting too low for my liking.
From github, the earlier 07app2ext:
Code:
#!/system/bin/sh
if [ "$SD_EXT_DIRECTORY" = "" ];
then
SD_EXT_DIRECTORY=/sd-ext
fi
if [ "`egrep -q $SD_EXT_DIRECTORY /proc/mounts;echo $?`" != "0" ];
then
echo "$SD_EXT_DIRECTORY not mounted.. skipping a2sd"
exit
fi
for dir in app app-private dalvik-cache;do
if [ "`egrep -q \"/data/${dir}\" /proc/mounts;echo $?`" != "0" ];
then
if [ ! -e "${SD_EXT_DIRECTORY}/${dir}" ];
then
install -m 771 -o 1000 -g 1000 -d ${SD_EXT_DIRECTORY}/${dir}
fi
if [ -L "/data/${dir}" ];
then
rm /data/${dir}
install -m 771 -o 1000 -g 1000 -d /data/${dir}
fi
if [ "${dir}" = "dalvik-cache" ];
then
if [ ! -L "/data/${dir}" ];
then
rm -rf /data/${dir}
install -m 771 -o 1000 -g 1000 -d /data/${dir}
fi
fi
if [ "${dir}" = "app" -o "${dir}" = "app-private" ];
then
for app in `find /data/${dir} -type f -iname "*.apk" -o -iname "*.zip"`;do
mv ${app} ${SD_EXT_DIRECTORY}/${dir}/
done
fi
mount -o bind ${SD_EXT_DIRECTORY}/${dir}/ /data/${dir}
fi
done
chmod 755 /system/etc/init.d/07app2ext
chown -R 0.2000 /system/etc/init.d
sleep 1
Click to expand...
Click to collapse
It works on MIUI?
I think so.
It's based on CM7, yeah?
If people are using app2ext on MIUI then I'd say yes.
If it has an 07app2ext file, then it's 100% guaranteed.
What I did was I replaced the 07app2ext file in the update zip with the one above so when it gets flashed I don't have to do anything.
It has an 07app2ext file, so a replace with this and my app2ext didnt work anymore...
There is my older app2ext code:
Code:
#!/system/bin/sh
if [ "$SD_EXT_DIRECTORY" = "" ];
then
SD_EXT_DIRECTORY=/sd-ext
fi
if [ "`egrep -q $SD_EXT_DIRECTORY /proc/mounts;echo $?`" != "0" ];
then
echo "$SD_EXT_DIRECTORY not mounted.. skipping a2sd"
exit
fi
if [ -L "/data/dalvik-cache" ];
then
rm /data/dalvik-cache
install -m 771 -o 1000 -g 1000 -d /data/dalvik-cache
fi
if [ -e "${SD_EXT_DIRECTORY}/dalvik-cache" ];
then
rm -rf ${SD_EXT_DIRECTORY}/dalvik-cache
fi
for dir in app app-private;do
if [ "`egrep -q \"/data/${dir}\" /proc/mounts;echo $?`" != "0" ];
then
if [ ! -e "${SD_EXT_DIRECTORY}/${dir}" ];
then
install -m 771 -o 1000 -g 1000 -d ${SD_EXT_DIRECTORY}/${dir}
fi
if [ -L "/data/${dir}" ];
then
rm /data/${dir}
install -m 771 -o 1000 -g 1000 -d /data/${dir}
fi
if [ "${dir}" = "app" -o "${dir}" = "app-private" ];
then
for app in `find /data/${dir} -type f -iname "*.apk" -o -iname "*.zip"`;do
mv ${app} ${SD_EXT_DIRECTORY}/${dir}/
done
fi
mount -o bind ${SD_EXT_DIRECTORY}/${dir}/ /data/${dir}
fi
done
ah... sometimes that happens...
If you were to put that in the MIUI update zip and flash it, it will work.
I don't know why that happens.
When it happened to me I couldnt figure it out either since I made sure the permissions stayed the same. Maybe it would work as a standalone flashable zip but I have never made one.
Zeppe, can you send me your 07app2ext and tell me what permissions it have? I have 500 mb in the ext partition but i can load it to maximum 'cause my internal storage get full. Now i have about 80 apps, and only 22mb left in the internal storage.
Attached.
Permissions are the same as other files in ect/init.d
xxx
xox
ooo
But when I did it manually, it didn't work
edit... try the attached update.zip... it just might work
either way, the file is in there.
BAZINGA! lol!! It works!!! Thanks a lot zeppelin!
heh
Sent from my Milestone using Tapatalk
zeppelinrox said:
Attached.
Permissions are the same as other files in ect/init.d
xxx
xox
ooo
But when I did it manually, it didn't work
edit... try the attached update.zip... it just might work
either way, the file is in there.
Click to expand...
Click to collapse
zeppelinrox, can I apply this update on CM7 RC10? Is it safe to do it?
I want to move my dalvik cache to ext2 because my internal storage its almost full (less than 20MB free).
Yes its fine.
It's a mod of an overclock flashable zip so when you flash it, it gives an overclock related message.
You can also replace the app2ext script in the cm7 update with the one in this zip file with 7zip and without extracting the cm7 update.
I just leave it in AOR's update folder tho.
So when I flash a rom, I flash this too
Sent from my Milestone using Tapatalk
Thanks for this script, it works perfectly.
I've applied the update from AOR and after move any app from SD to ext2 and reboot, CM7 moves dalvik cache for that apps to ext2.
Now, I suppose any time I update the ROM then before reboot I need to apply this script again.
Sent from my Milestone using XDA App
Yes as an update would probably overwrite this app2ext script
Sent from my Milestone using Tapatalk

Bricked TP revival tip, SEE POST 2

Is anyone aware if there's anybody that will repair a bricked TP?
jlc0312 said:
Did you have the questionmark of death(QOD)? I had QOD before it died completely and jcsullins walkthrough fixed it. jcsullins is a boss dog, he has been walking people through unbricking their touchpads for over a month, and today came out with a do it yourself guide.
http://rootzwiki.com/topic/38786-tpdebrick-v004/
best of luck
Click to expand...
Click to collapse
I did this yesterday and successfully revived my brothers completely dead touchpad. Wanted to post a link but found you already posted. Anyway here is what I learnt and I hope it helps others.
Steps from jsullins procedure:
1) download a ubuntu i386 iso, burn it to a usb drive using pendrivelinux (a windows tool). Make sure you set atleast 1GB for the reusable R/W filesystem (casper filesystem). Note: a virtual instance of ubuntu will NOT work.
2) boot into ubuntu, change your bios settings to allow usb booting if needed
3) follow the guide. the simple steps are
a) download the webosdoctor jar file
b) download the tpdebrick004 zip
c) extract tpdebrick004
d) connect your tochpad via usb and hold the power+home+vol down buttons for 20-30 seconds
e) run the tpdebrick script with the storage size as parameter.
ex: sudo tpdebrick 32
note: if you use a version of ubuntu other than 12.04 you will need to edit ("sudo gedit tpdebrick")the tpdebrick script and change the version check code to look for that version instead of 12.04. i.e change 12.04 to 12.10 or 13.04 (as applicable)
f) the script installs fastboot, dfu-util and other components and then proceeds with the de-bricking process. wait till you see "ALL DONE". If it asks for a root password just keep pressing enter.
4) charge your touchpad for 5-10 hours on the 2A charger. You should see the home button blinking at this point.
Thanks, I will try this when I get the chance.
I've changed the thread title
Would this work if the battery is completely dead. I believe mine is. I get absolutely no response from the touchpad. Tried all the button combinations with two different original chargers and tried trickle charging it. If my battery went below the safe threshold would I have to replace it?
zaq123 said:
Would this work if the battery is completely dead. I believe mine is. I get absolutely no response from the touchpad. Tried all the button combinations with two different original chargers and tried trickle charging it. If my battery went below the safe threshold would I have to replace it?
Click to expand...
Click to collapse
You would need to fully charge using the charging block. If you elect to charge through a PC/Laptop USB it should charge for several days. Using the block only needs 5-6 hours to accomplish the steps. Then a full charge would need to be accomplished using the block.
TonyStark said:
You would need to fully charge using the charging block. If you elect to charge through a PC/Laptop USB it should charge for several days. Using the block only needs 5-6 hours to accomplish the steps. Then a full charge would need to be accomplished using the block.
Click to expand...
Click to collapse
Left it on the charging block for 30 hours still no response and the tpdebrick does not find the device. Is it gone? I read on some posts that if the voltage drops below a certain threshold it wont charge anymore.
zaq123 said:
Left it on the charging block for 30 hours still no response and the tpdebrick does not find the device. Is it gone? I read on some posts that if the voltage drops below a certain threshold it wont charge anymore.
Click to expand...
Click to collapse
Hadn't read that, however I needed to replace my block and usb (new OE). I realized mine wasn't up to par.
zaq123 said:
Left it on the charging block for 30 hours still no response and the tpdebrick does not find the device. Is it gone? I read on some posts that if the voltage drops below a certain threshold it wont charge anymore.
Click to expand...
Click to collapse
Does anything happen if:
1: You hold power and volume up
2: power and home buttons for at least 30 seconds preferably a minute.
3 if you connect to your PC does anything show in device manager or when you right click on the safely remove icon.
sstar said:
Does anything happen if:
1: You hold power and volume up
2: power and home buttons for at least 30 seconds preferably a minute.
3 if you connect to your PC does anything show in device manager or when you right click on the safely remove icon.
Click to expand...
Click to collapse
I get no response doing any of those or any other button combination that has been suggested on different forums. I know the charger is good since i have another touchpad that I use it with. It is an original hp. I ordered a touchstone since some people have has success getting the touchstone to charge it when the regular would not.
Any other suggestions would be appreciated. Thanks
zaq123 said:
Would this work if the battery is completely dead.
Click to expand...
Click to collapse
Yup that's what I wrote
britoso said:
Yup that's what I wrote
Click to expand...
Click to collapse
It doesnt work I get no response. lipo batteries wont charge if they go below a certain voltage for safety reasons. On this battery it is 3.6/37 volts. Unless you use a lipo charger which are dangerous since you can end up with a fire.
Anyways I get no response at all pressing any combination of buttons.
When tpdebrick says to press power + home + vol-down it gives no response.
Any ideas?
zaq123 said:
It doesnt work I get no response. lipo batteries wont charge if they go below a certain voltage for safety reasons. On this battery it is 3.6/37 volts. Unless you use a lipo charger which are dangerous since you can end up with a fire.
Anyways I get no response at all pressing any combination of buttons.
When tpdebrick says to press power + home + vol-down it gives no response.
Any ideas?
Click to expand...
Click to collapse
I'm on the same boat, I did get the "all done" message after running the tpdebrick, im on hour 3 of charging, nothing yet, will post soon, fingers crossed, TP dead for over 3 months now
zaq123 said:
It doesnt work I get no response. lipo batteries wont charge if they go below a certain voltage for safety reasons. On this battery it is 3.6/37 volts. Unless you use a lipo charger which are dangerous since you can end up with a fire.
Anyways I get no response at all pressing any combination of buttons.
When tpdebrick says to press power + home + vol-down it gives no response.
Any ideas?
Click to expand...
Click to collapse
You are plugged in to a usb port and holding the 3 buttons for 20+ seconds right? Maybe you can leave it on the charger for a day first.
The one I fixed was dead for almost a year. the script failed to read the battery level.
britoso said:
You are plugged in to a usb port and holding the 3 buttons for 20+ seconds right? Maybe you can leave it on the charger for a day first.
The one I fixed was dead for almost a year. the script failed to read the battery level.
Click to expand...
Click to collapse
I tried that left it plugged in for almost two days. tried both the hp charger and a trickle charge. Right now I have it on a touchstone maybe that will work.
Tried all the button combinations still hoping.
miroxlava said:
I'm on the same boat, I did get the "all done" message after running the tpdebrick, im on hour 3 of charging, nothing yet, will post soon, fingers crossed, TP dead for over 3 months now
Click to expand...
Click to collapse
#!/bin/sh
###################################
### TPDebrick v004 by jcsullins ###
###################################
check_pgms()
{
local have_other=1
local ok_install=0
local lsb_rel
local lsb_id
local SP
if ! `which perl >/dev/null 2>&1`;
then
echo "perl not found"
echo "Aborting."
exit 1
fi
lsb_rel=`lsb_release --short --release`
lsb_id=`lsb_release --short --id`
if [ -n "$lsb_rel" -a -n "${lsb_id}" -a "${lsb_id}" = "Ubuntu" ];
then
if [ "${lsb_rel}" = "11.04" -o "${lsb_rel}" = "11.10" -o "${lsb_rel}" = "12.04" ];
then
ok_install=1
fi
fi
if ! `which dfu-util >/dev/null 2>&1`;
then
echo "dfu-util not installed"
have_other=0
fi
if ! `which fastboot >/dev/null 2>&1`;
then
echo "fastboot not installed"
have_other=0
fi
if [ $have_other -eq 1 ];
then
return;
fi
if [ $ok_install -eq 0 ];
then
echo "Aborted."
exit 1
fi
if `which software-properties-kde >/dev/null 2>&1`;
then
SP=software-properties-kde
else
SP=software-properties-gtk
fi
echo "Installing dfu-util/fastboot ..."
$SP --enable-component universe
if [ $? -ne 0 ];
then
echo "Enable universe failed."
echo "Aborted."
exit 1
fi
add-apt-repository --yes ppa:nilarimogard/webupd8
if [ $? -ne 0 ];
then
echo "add-apt-repository failed"
echo "Aborted."
exit 1
fi
apt-get update
if [ $? -ne 0 ];
then
echo "apt-get update failed"
echo "Aborted."
exit 1
fi
apt-get --yes install dfu-util
if [ $? -ne 0 ];
then
echo "install dfu-util failed"
echo "Aborted."
exit 1
fi
apt-get --yes install android-tools-fastboot
if [ $? -ne 0 ];
then
echo "install fastboot failed"
echo "Aborted."
exit 1
fi
}
check_files()
{
local chk_list
local need_files=0
local doc_fn
local doc_fn_wifi="webosdoctorp305hstnhwifi.jar"
local doc_fn_3g="webosdoctorp305hstnhatt.jar"
echo "checking doc files ..."
chk_list="sbl1.mbn sbl2.mbn sbl3.mbn rpm.mbn tz.mbn"
chk_list="${chk_list} emmc_appsboot.mbn"
chk_list="${chk_list} bootie-topaz305.bin"
chk_list="${chk_list} PmA6Updater"
chk_list="${chk_list} a6_firmware.txt.00"
for fn in $chk_list
do
if [ ! -r ${fn} ];
then
need_files=1
fi
done
if [ $need_files -eq 0 ];
then
return
fi
if [ -r ../${doc_fn_wifi} ];
then
doc_fn=../${doc_fn_wifi}
fi
if [ -r ../${doc_fn_3g} ];
then
doc_fn=../${doc_fn_3g}
fi
if [ -z "${doc_fn}" ];
then
echo "could not find ../${doc_fn_wifi} or ../${doc_fn_3g}"
echo "Aborted."
exit 1
fi
echo "extracting doc files ..."
unzip -p "${doc_fn}" resources/webOS.tar \
| tar -xOf - ./nova-cust-image-topaz.rootfs.tar.gz \
| tar -xzOf - ./boot/boot-genesis.tar.gz \
| tar -xzf -
if [ $? -ne 0 ];
then
echo "failed to extract core bootloaders"
echo "Aborted."
exit 1
fi
unzip -p "${doc_fn}" resources/webOS.tar | \
tar -xOf - ./boot-topaz.bin \
>bootie-topaz305-raw.bin
if [ $? -ne 0 ];
then
echo "failed to extract boot.bin"
echo "Aborted."
exit 1
fi
PRINTF=`which printf 2>/dev/null`
if [ $? -ne 0 ];
then
echo "printf not found."
echo "Aborting."
exit 1
fi
$PRINTF "\x1C\xC3\x01\x00\x00\x00\x80\x40" >bootie-topaz305.bin
cat bootie-topaz305-raw.bin >>bootie-topaz305.bin
$PRINTF "\x18\xDA\x06\x15" >>bootie-topaz305.bin
unzip -p "${doc_fn}" resources/webOS.tar \
| tar -xOf - ./nova-cust-image-topaz.rootfs.tar.gz \
| tar -xzOf - ./usr/bin/PmA6Updater \
>PmA6Updater
if [ $? -ne 0 ];
then
echo "failed to extract PmA6Updater"
echo "Aborted."
exit 1
fi
chmod 755 PmA6Updater
unzip -p "${doc_fn}" resources/webOS.tar | tar -xOf - ./nova-cust-image-topaz.rootfs.tar.gz | tar -xzOf - ./lib/firmware/a6_firmware.txt.00 >a6_firmware.txt.00
if [ $? -ne 0 ];
then
echo "failed to extract a6_firmware.txt.00"
echo "Aborted."
exit 1
fi
}
check_config_files()
{
local cfgf=$1
echo -n "Checking that config/files are valid... "
if [ \! -r ${cfgf} ];
then
echo "FAILED"
echo "Cannot read config file ${cfgf}"
echo "Aborted."
exit 1
fi
while read fname pos md5
do
if [ "${fname}" = '#' ];
then
continue
fi
if [ \! -r "${fname}" ];
then
echo "FAILED"
echo "Cannot read file ${fname}"
echo "Aborted."
exit 1
fi
if [ "${md5}" = "nocheck" ];
then
continue;
fi
CHK_MD5=`md5sum ${fname} | cut -d' ' -f1`
if [ "${CHK_MD5}" != "${md5}" ];
then
echo "FAILED"
echo "File ${fname} failed check."
echo "Aborted."
exit 1
fi
done <${cfgf}
echo "OK"
}
load_files()
{
local cfgf=$1
while read fname pos md5
do
if [ "${fname}" = '#' ];
then
continue;
fi
echo "Writing file ${fname} ... "
addr=$(($pos * 512))
perl qdload.pl --laddr ${addr} --lfile ${fname}
if [ $? -ne 0 ];
then
echo "Cannot write file ${fname}"
echo "Aborted."
exit 1
fi
done <${cfgf}
echo "Done writing files."
}
check_usbdevs()
{
local tmout="$1"
shift
local dev_ids="$*"
local check_flag=1
while [ $check_flag -eq 1 ];
do
for dev_id in $dev_ids
do
dev_count=`lsusb | cut -d' ' -f6 | grep "^${dev_id}" | wc -l`
if [ $dev_count -gt 0 ];
then
return 0
fi
done
if [ $tmout -le 0 ];
then
check_flag=0
else
sleep 1
tmout=$((tmout - 1))
fi
done
return 1
}
get_usbdev_info()
{
local devid=$1
local field=$2
local filter=$3
if [ $field -eq 1 ];
then
lsusb -vv -d $devid |
while read a b c
do
if [ "x${a}" = "x${filter}" ];
then
echo "${b}"
return
fi
done
else
lsusb -vv -d $devid |
while read a b c
do
if [ "x${a}" = "x${filter}" ];
then
echo "${c}"
return
fi
done
fi
}
check_qdlmode()
{
local devid_qdl="05c6:9008"
local imanfac1="`get_usbdev_info $devid_qdl 1 iManufacturer`"
local imanfac2="`get_usbdev_info $devid_qdl 2 iManufacturer`"
local iprod1="`get_usbdev_info $devid_qdl 1 iProduct`"
local iprod2="`get_usbdev_info $devid_qdl 2 iProduct`"
if [ -z "${imanfac1}" -o -z "${iprod1}" ];
then
return 1
fi
if [ -z "${imanfac2}" -o -z "${iprod2}" ];
then
return 1
fi
if [ "${imanfac1}" != "3" ];
then
return 1
fi
if [ "${imanfac2}" != "Qualcomm, Incorporated" ];
then
return 1
fi
if [ "${iprod1}" != "2" ];
then
return 1
fi
if [ "${iprod2}" != "Qualcomm CDMA Technologies MSM" ];
then
return 1
fi
return 0
}
check_qdlmode2()
{
local devid_qdl="05c6:9008"
local imanfac1="`get_usbdev_info $devid_qdl 1 iManufacturer`"
local imanfac2="`get_usbdev_info $devid_qdl 2 iManufacturer`"
local iprod1="`get_usbdev_info $devid_qdl 1 iProduct`"
local iprod2="`get_usbdev_info $devid_qdl 2 iProduct`"
if [ -z "${imanfac1}" -o -z "${iprod1}" ];
then
return 1
fi
if [ -z "${imanfac2}" -o -z "${iprod2}" ];
then
return 1
fi
if [ "${imanfac1}" != "1" ];
then
return 1
fi
if [ "${imanfac2}" != "Qualcomm CDMA Technologies MSM" ];
then
return 1
fi
if [ "${iprod1}" != "2" ];
then
return 1
fi
if [ "${iprod2}" != "QHSUSB_DLOAD" ];
then
return 1
fi
return 0
}
#####
##### MAIN
#####
devid_qdl="05c6:9008"
if [ $# -ne 1 ];
then
echo "Usage: ${0} 16|32|64"
exit 1
fi
if [ "$1" != "16" -a "$1" != "32" -a "$1" != "64" ];
then
echo "Usage: ${0} 16|32|64"
exit 1
fi
tptype="$1"
if [ `id -u` -ne 0 ];
then
echo "Must run as superuser (i.e. sudo ...)"
echo "Aborting"
exit 1
fi
check_pgms
check_files
devid_qdl="05c6:9008"
devid_dfu="0830:8070"
devid_fastboot="18d1:d00d"
devid_netchip="0525:a4aa"
if `check_usbdevs 0 $devid_qdl`;
then
if ! `check_qdlmode2`;
then
echo "Incorrect QDL mode found."
echo "Please hold Power+Home+VolumeDown for 20-30 secs, then retry."
echo "Aborted."
exit 1
fi
else
echo "Connect Touchpad then hold Power+Home+VolumeDown for 30 seconds ..."
if ! `check_usbdevs 120 $devid_qdl`
then
echo "QDL mode not found"
echo "Aborting."
exit 1
else
echo "Release buttons now"
sleep 5
fi
fi
perl qdload.pl --pfile emmcbld.bin
if [ $? -ne 0 ];
then
echo "load of emmcbld.bin failed"
echo "Aborting."
exit 1
fi
sleep 3
echo "Checking QDL mode..."
if ! `check_qdlmode`;
then
echo "QDL second stage mode not found"
echo "Aborting"
exit 1
fi
load_files tp${tptype}nobootie.cfg
echo "Reseting device..."
perl qdload.pl --lreset
echo "Waiting for fastboot mode..."
if ! `check_usbdevs 60 ${devid_fastboot}`
then
echo "fastboot mode not found"
echo "Aborted."
exit 1
fi
echo "Loading TPToolbox-Headless ..."
fastboot flash bootmem TPToolbox-Headless-v004
if [ $? -ne 0 ];
then
echo "TPToolbox-Headless load failed"
echo "Aborted."
exit 1
fi
echo "Waiting for netchip mode... (may take 3+ mins)"
if ! `check_usbdevs 200 ${devid_netchip}`
then
echo "netchip mode not found"
echo "Aborted."
exit 1
fi
echo "Waiting for ping check... (may take 1-2 mins)"
ccnt=120
ping_ok=0
while [ $ccnt -gt 0 ];
do
ping -c 1 -W 1 192.168.7.7 >/dev/null 2>&1
if [ $? -eq 0 ];
then
ccnt=0
ping_ok=1
fi
ccnt=$(($ccnt - 1))
done
if [ $ping_ok -eq 0 ];
then
echo "ping check failed"
echo "check firewall/networking setup"
echo "access to the 192.68.7.7 host (Touchpad) failed"
echo "Aborted."
exit 1
fi
echo "Checking/updating known_hosts..."
need_khosts=0
if [ ! -r ~root/.ssh/known_hosts ];
then
need_khosts=1
else
chk1=`ssh-keygen -F 192.168.7.7 -f ~root/.ssh/known_hosts | wc -l`
if [ $? -ne 0 ];
then
echo "Failed to check known_hosts"
echo "Aborted."
exit 1
fi
if [ $chk1 -eq 0 ];
then
need_khosts=1
fi
fi
if [ $need_khosts -eq 1 ];
then
mkdir -p ~root/.ssh
cat khosts >>~root/.ssh/known_hosts
fi
echo "Copying A6 files..."
scp -i ssh-key a6_firmware.txt.00 PmA6Updater [email protected]:/tmp
if [ $? -ne 0 ];
then
echo "A6 files copy failed."
echo "Aborted."
exit 1
fi
echo "Copying bootloader files..."
scp -i ssh-key bootie-topaz305.bin emmc_appsboot.mbn [email protected]:/tmp
if [ $? -ne 0 ];
then
echo "bootloader files copy failed."
echo "Aborted."
exit 1
fi
echo ""
echo "Checking A6 firmware..."
ssh -i ssh-key [email protected] /tmp/PmA6Updater -x -d 0 /tmp/a6_firmware.txt.00
## if [ $? -ne 0 ];
## then
## echo "A6 firmware check failed."
## echo "Aborted."
## exit 1
## fi
echo ""
echo "Updating A6 firmware..."
ssh -i ssh-key [email protected] /tmp/PmA6Updater -f -d 0 /tmp/a6_firmware.txt.00
if [ $? -ne 0 ];
then
echo "A6 firmware update failed."
echo "Aborted."
exit 1
fi
echo ""
echo "Capturing DMESG..."
ssh -i ssh-key [email protected] dmesg
if [ $? -ne 0 ];
then
echo "dmesg capture failed"
echo "Aborted."
exit 1
fi
echo ""
echo "Updating bootloader emmc_appsboot..."
ssh -i ssh-key [email protected] dd if=/tmp/emmc_appsboot.mbn of=/dev/mmcblk0p7
if [ $? -ne 0 ];
then
echo "update bootloader emmc_appsboot failed."
echo "Aborted."
exit 1
fi
echo ""
echo "Updating bootloader bootie..."
ssh -i ssh-key [email protected] dd if=/tmp/bootie-topaz305.bin of=/dev/mmcblk0p8
if [ $? -ne 0 ];
then
echo "update bootloader bootie failed."
echo "Aborted."
exit 1
fi
echo ""
echo "Checking battery voltage/percent... "
bvolt=`ssh -i ssh-key [email protected] cat /sys/devices/i2c-3/3-0031/getvoltage`
if [ $? -ne 0 ];
then
echo "getvoltage failed"
echo "Aborted."
exit 1
fi
bperc=`ssh -i ssh-key [email protected] cat /sys/devices/i2c-3/3-0031/getpercent`
if [ $? -ne 0 ];
then
echo "getpercent failed"
echo "Aborted."
exit 1
fi
echo "Battery Voltage=${bvolt} Percent=${bperc}"
if [ $bperc -gt 5 ];
then
echo "Rebooting Touchpad ..."
ssh -i ssh-key [email protected] "(sleep 1;/sbin/reboot -f) &"
echo "ALL DONE."
exit 0
fi
if [ $bperc -gt 0 ];
then
echo "Rebooting Touchpad ..."
ssh -i ssh-key [email protected] "(sleep 1;/sbin/reboot -f) &"
echo "Connect touchpad to stock HP AC charger to allow to charge"
echo "ALL DONE."
exit 0
fi
echo ""
echo "Waiting 1 min before checking voltage/percent again (1/2) ..."
sleep 60
bvolt=`ssh -i ssh-key [email protected] cat /sys/devices/i2c-3/3-0031/getvoltage`
if [ $? -ne 0 ];
then
echo "getvoltage failed"
echo "Aborted."
exit 1
fi
bperc=`ssh -i ssh-key [email protected] cat /sys/devices/i2c-3/3-0031/getpercent`
if [ $? -ne 0 ];
then
echo "getpercent failed"
echo "Aborted."
exit 1
fi
echo "Battery Voltage=${bvolt} Percent=${bperc}"
echo ""
echo "Waiting 1 min before checking voltage/percent again (2/2) ..."
sleep 60
bvolt=`ssh -i ssh-key [email protected] cat /sys/devices/i2c-3/3-0031/getvoltage`
if [ $? -ne 0 ];
then
echo "getvoltage failed"
echo "Aborted."
exit 1
fi
bperc=`ssh -i ssh-key [email protected] cat /sys/devices/i2c-3/3-0031/getpercent`
if [ $? -ne 0 ];
then
echo "getpercent failed"
echo "Aborted."
exit 1
fi
echo "Battery Voltage=${bvolt} Percent=${bperc}"
echo "Rebooting Touchpad ..."
ssh -i ssh-key [email protected] "(sleep 1;/sbin/reboot -f) &"
echo "Connect Touchpad to stock HP AC charger now"
echo "and allow it to charge for several hours"
echo "ALL DONE."
not working, im running 12.10 and the only way it works is if I gedit tpdebrick 12.10... but how should i type it? sudo gedit tpdebrick 12.10 ./tpdebrick 32 ???
Please wrap [ hide ] and [/ hide ] (with no spacing between hide and brackets) so your post look like this
,,,,,,,,,
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
###################################
### TPDebrick v004 by jcsullins ###
###################################
check_pgms()
{
local have_other=1
local ok_install=0
local lsb_rel
local lsb_id
local SP
if ! `which perl >/dev/null 2>&1`;
then
echo "perl not found"
echo "Aborting."
exit 1
fi
lsb_rel=`lsb_release --short --release`
lsb_id=`lsb_release --short --id`
if [ -n "$lsb_rel" -a -n "${lsb_id}" -a "${lsb_id}" = "Ubuntu" ];
then
if [ "${lsb_rel}" = "11.04" -o "${lsb_rel}" = "11.10" -o "${lsb_rel}" = "12.04" ];
then
ok_install=1
fi
fi
if ! `which dfu-util >/dev/null 2>&1`;
then
echo "dfu-util not installed"
have_other=0
fi
if ! `which fastboot >/dev/null 2>&1`;
then
echo "fastboot not installed"
have_other=0
fi
if [ $have_other -eq 1 ];
then
return;
fi
if [ $ok_install -eq 0 ];
then
echo "Aborted."
exit 1
fi
if `which software-properties-kde >/dev/null 2>&1`;
then
SP=software-properties-kde
else
SP=software-properties-gtk
fi
echo "Installing dfu-util/fastboot ..."
$SP --enable-component universe
if [ $? -ne 0 ];
then
echo "Enable universe failed."
echo "Aborted."
exit 1
fi
add-apt-repository --yes ppa:nilarimogard/webupd8
if [ $? -ne 0 ];
then
echo "add-apt-repository failed"
echo "Aborted."
exit 1
fi
apt-get update
if [ $? -ne 0 ];
then
echo "apt-get update failed"
echo "Aborted."
exit 1
fi
apt-get --yes install dfu-util
if [ $? -ne 0 ];
then
echo "install dfu-util failed"
echo "Aborted."
exit 1
fi
apt-get --yes install android-tools-fastboot
if [ $? -ne 0 ];
then
echo "install fastboot failed"
echo "Aborted."
exit 1
fi
}
check_files()
{
local chk_list
local need_files=0
local doc_fn
local doc_fn_wifi="webosdoctorp305hstnhwifi.jar"
local doc_fn_3g="webosdoctorp305hstnhatt.jar"
echo "checking doc files ..."
chk_list="sbl1.mbn sbl2.mbn sbl3.mbn rpm.mbn tz.mbn"
chk_list="${chk_list} emmc_appsboot.mbn"
chk_list="${chk_list} bootie-topaz305.bin"
chk_list="${chk_list} PmA6Updater"
chk_list="${chk_list} a6_firmware.txt.00"
for fn in $chk_list
do
if [ ! -r ${fn} ];
then
need_files=1
fi
done
if [ $need_files -eq 0 ];
then
return
fi
if [ -r ../${doc_fn_wifi} ];
then
doc_fn=../${doc_fn_wifi}
fi
if [ -r ../${doc_fn_3g} ];
then
doc_fn=../${doc_fn_3g}
fi
if [ -z "${doc_fn}" ];
then
echo "could not find ../${doc_fn_wifi} or ../${doc_fn_3g}"
echo "Aborted."
exit 1
fi
echo "extracting doc files ..."
unzip -p "${doc_fn}" resources/webOS.tar \
| tar -xOf - ./nova-cust-image-topaz.rootfs.tar.gz \
| tar -xzOf - ./boot/boot-genesis.tar.gz \
| tar -xzf -
if [ $? -ne 0 ];
then
echo "failed to extract core bootloaders"
echo "Aborted."
exit 1
fi
unzip -p "${doc_fn}" resources/webOS.tar | \
tar -xOf - ./boot-topaz.bin \
>bootie-topaz305-raw.bin
if [ $? -ne 0 ];
then
echo "failed to extract boot.bin"
echo "Aborted."
exit 1
fi
PRINTF=`which printf 2>/dev/null`
if [ $? -ne 0 ];
then
echo "printf not found."
echo "Aborting."
exit 1
fi
$PRINTF "\x1C\xC3\x01\x00\x00\x00\x80\x40" >bootie-topaz305.bin
cat bootie-topaz305-raw.bin >>bootie-topaz305.bin
$PRINTF "\x18\xDA\x06\x15" >>bootie-topaz305.bin
unzip -p "${doc_fn}" resources/webOS.tar \
| tar -xOf - ./nova-cust-image-topaz.rootfs.tar.gz \
| tar -xzOf - ./usr/bin/PmA6Updater \
>PmA6Updater
if [ $? -ne 0 ];
then
echo "failed to extract PmA6Updater"
echo "Aborted."
exit 1
fi
chmod 755 PmA6Updater
unzip -p "${doc_fn}" resources/webOS.tar | tar -xOf - ./nova-cust-image-topaz.rootfs.tar.gz | tar -xzOf - ./lib/firmware/a6_firmware.txt.00 >a6_firmware.txt.00
if [ $? -ne 0 ];
then
echo "failed to extract a6_firmware.txt.00"
echo "Aborted."
exit 1
fi
}
check_config_files()
{
local cfgf=$1
echo -n "Checking that config/files are valid... "
if [ \! -r ${cfgf} ];
then
echo "FAILED"
echo "Cannot read config file ${cfgf}"
echo "Aborted."
exit 1
fi
while read fname pos md5
do
if [ "${fname}" = '#' ];
then
continue
fi
if [ \! -r "${fname}" ];
then
echo "FAILED"
echo "Cannot read file ${fname}"
echo "Aborted."
exit 1
fi
if [ "${md5}" = "nocheck" ];
then
continue;
fi
CHK_MD5=`md5sum ${fname} | cut -d' ' -f1`
if [ "${CHK_MD5}" != "${md5}" ];
then
echo "FAILED"
echo "File ${fname} failed check."
echo "Aborted."
exit 1
fi
done <${cfgf}
echo "OK"
}
load_files()
{
local cfgf=$1
while read fname pos md5
do
if [ "${fname}" = '#' ];
then
continue;
fi
echo "Writing file ${fname} ... "
addr=$(($pos * 512))
perl qdload.pl --laddr ${addr} --lfile ${fname}
if [ $? -ne 0 ];
then
echo "Cannot write file ${fname}"
echo "Aborted."
exit 1
fi
done <${cfgf}
echo "Done writing files."
}
check_usbdevs()
{
local tmout="$1"
shift
local dev_ids="$*"
local check_flag=1
while [ $check_flag -eq 1 ];
do
for dev_id in $dev_ids
do
dev_count=`lsusb | cut -d' ' -f6 | grep "^${dev_id}" | wc -l`
if [ $dev_count -gt 0 ];
then
return 0
fi
done
if [ $tmout -le 0 ];
then
check_flag=0
else
sleep 1
tmout=$((tmout - 1))
fi
done
return 1
}
get_usbdev_info()
{
local devid=$1
local field=$2
local filter=$3
if [ $field -eq 1 ];
then
lsusb -vv -d $devid |
while read a b c
do
if [ "x${a}" = "x${filter}" ];
then
echo "${b}"
return
fi
done
else
lsusb -vv -d $devid |
while read a b c
do
if [ "x${a}" = "x${filter}" ];
then
echo "${c}"
return
fi
done
fi
}
check_qdlmode()
{
local devid_qdl="05c6:9008"
local imanfac1="`get_usbdev_info $devid_qdl 1 iManufacturer`"
local imanfac2="`get_usbdev_info $devid_qdl 2 iManufacturer`"
local iprod1="`get_usbdev_info $devid_qdl 1 iProduct`"
local iprod2="`get_usbdev_info $devid_qdl 2 iProduct`"
if [ -z "${imanfac1}" -o -z "${iprod1}" ];
then
return 1
fi
if [ -z "${imanfac2}" -o -z "${iprod2}" ];
then
return 1
fi
if [ "${imanfac1}" != "3" ];
then
return 1
fi
if [ "${imanfac2}" != "Qualcomm, Incorporated" ];
then
return 1
fi
if [ "${iprod1}" != "2" ];
then
return 1
fi
if [ "${iprod2}" != "Qualcomm CDMA Technologies MSM" ];
then
return 1
fi
return 0
}
check_qdlmode2()
{
local devid_qdl="05c6:9008"
local imanfac1="`get_usbdev_info $devid_qdl 1 iManufacturer`"
local imanfac2="`get_usbdev_info $devid_qdl 2 iManufacturer`"
local iprod1="`get_usbdev_info $devid_qdl 1 iProduct`"
local iprod2="`get_usbdev_info $devid_qdl 2 iProduct`"
if [ -z "${imanfac1}" -o -z "${iprod1}" ];
then
return 1
fi
if [ -z "${imanfac2}" -o -z "${iprod2}" ];
then
return 1
fi
if [ "${imanfac1}" != "1" ];
then
return 1
fi
if [ "${imanfac2}" != "Qualcomm CDMA Technologies MSM" ];
then
return 1
fi
if [ "${iprod1}" != "2" ];
then
return 1
fi
if [ "${iprod2}" != "QHSUSB_DLOAD" ];
then
return 1
fi
return 0
}
#####
##### MAIN
#####
devid_qdl="05c6:9008"
if [ $# -ne 1 ];
then
echo "Usage: ${0} 16|32|64"
exit 1
fi
if [ "$1" != "16" -a "$1" != "32" -a "$1" != "64" ];
then
echo "Usage: ${0} 16|32|64"
exit 1
fi
tptype="$1"
if [ `id -u` -ne 0 ];
then
echo "Must run as superuser (i.e. sudo ...)"
echo "Aborting"
exit 1
fi
check_pgms
check_files
devid_qdl="05c6:9008"
devid_dfu="0830:8070"
devid_fastboot="18d1:d00d"
devid_netchip="0525:a4aa"
if `check_usbdevs 0 $devid_qdl`;
then
if ! `check_qdlmode2`;
then
echo "Incorrect QDL mode found."
echo "Please hold Power+Home+VolumeDown for 20-30 secs, then retry."
echo "Aborted."
exit 1
fi
else
echo "Connect Touchpad then hold Power+Home+VolumeDown for 30 seconds ..."
if ! `check_usbdevs 120 $devid_qdl`
then
echo "QDL mode not found"
echo "Aborting."
exit 1
else
echo "Release buttons now"
sleep 5
fi
fi
perl qdload.pl --pfile emmcbld.bin
if [ $? -ne 0 ];
then
echo "load of emmcbld.bin failed"
echo "Aborting."
exit 1
fi
sleep 3
echo "Checking QDL mode..."
if ! `check_qdlmode`;
then
echo "QDL second stage mode not found"
echo "Aborting"
exit 1
fi
load_files tp${tptype}nobootie.cfg
echo "Reseting device..."
perl qdload.pl --lreset
echo "Waiting for fastboot mode..."
if ! `check_usbdevs 60 ${devid_fastboot}`
then
echo "fastboot mode not found"
echo "Aborted."
exit 1
fi
echo "Loading TPToolbox-Headless ..."
fastboot flash bootmem TPToolbox-Headless-v004
if [ $? -ne 0 ];
then
echo "TPToolbox-Headless load failed"
echo "Aborted."
exit 1
fi
echo "Waiting for netchip mode... (may take 3+ mins)"
if ! `check_usbdevs 200 ${devid_netchip}`
then
echo "netchip mode not found"
echo "Aborted."
exit 1
fi
echo "Waiting for ping check... (may take 1-2 mins)"
ccnt=120
ping_ok=0
while [ $ccnt -gt 0 ];
do
ping -c 1 -W 1 192.168.7.7 >/dev/null 2>&1
if [ $? -eq 0 ];
then
ccnt=0
ping_ok=1
fi
ccnt=$(($ccnt - 1))
done
if [ $ping_ok -eq 0 ];
then
echo "ping check failed"
echo "check firewall/networking setup"
echo "access to the 192.68.7.7 host (Touchpad) failed"
echo "Aborted."
exit 1
fi
echo "Checking/updating known_hosts..."
need_khosts=0
if [ ! -r ~root/.ssh/known_hosts ];
then
need_khosts=1
else
chk1=`ssh-keygen -F 192.168.7.7 -f ~root/.ssh/known_hosts | wc -l`
if [ $? -ne 0 ];
then
echo "Failed to check known_hosts"
echo "Aborted."
exit 1
fi
if [ $chk1 -eq 0 ];
then
need_khosts=1
fi
fi
if [ $need_khosts -eq 1 ];
then
mkdir -p ~root/.ssh
cat khosts >>~root/.ssh/known_hosts
fi
echo "Copying A6 files..."
scp -i ssh-key a6_firmware.txt.00 PmA6Updater [email protected]:/tmp
if [ $? -ne 0 ];
then
echo "A6 files copy failed."
echo "Aborted."
exit 1
fi
echo "Copying bootloader files..."
scp -i ssh-key bootie-topaz305.bin emmc_appsboot.mbn [email protected]:/tmp
if [ $? -ne 0 ];
then
echo "bootloader files copy failed."
echo "Aborted."
exit 1
fi
echo ""
echo "Checking A6 firmware..."
ssh -i ssh-key [email protected] /tmp/PmA6Updater -x -d 0 /tmp/a6_firmware.txt.00
## if [ $? -ne 0 ];
## then
## echo "A6 firmware check failed."
## echo "Aborted."
## exit 1
## fi
echo ""
echo "Updating A6 firmware..."
ssh -i ssh-key [email protected] /tmp/PmA6Updater -f -d 0 /tmp/a6_firmware.txt.00
if [ $? -ne 0 ];
then
echo "A6 firmware update failed."
echo "Aborted."
exit 1
fi
echo ""
echo "Capturing DMESG..."
ssh -i ssh-key [email protected] dmesg
if [ $? -ne 0 ];
then
echo "dmesg capture failed"
echo "Aborted."
exit 1
fi
echo ""
echo "Updating bootloader emmc_appsboot..."
ssh -i ssh-key [email protected] dd if=/tmp/emmc_appsboot.mbn of=/dev/mmcblk0p7
if [ $? -ne 0 ];
then
echo "update bootloader emmc_appsboot failed."
echo "Aborted."
exit 1
fi
echo ""
echo "Updating bootloader bootie..."
ssh -i ssh-key [email protected] dd if=/tmp/bootie-topaz305.bin of=/dev/mmcblk0p8
if [ $? -ne 0 ];
then
echo "update bootloader bootie failed."
echo "Aborted."
exit 1
fi
echo ""
echo "Checking battery voltage/percent... "
bvolt=`ssh -i ssh-key [email protected] cat /sys/devices/i2c-3/3-0031/getvoltage`
if [ $? -ne 0 ];
then
echo "getvoltage failed"
echo "Aborted."
exit 1
fi
bperc=`ssh -i ssh-key [email protected] cat /sys/devices/i2c-3/3-0031/getpercent`
if [ $? -ne 0 ];
then
echo "getpercent failed"
echo "Aborted."
exit 1
fi
echo "Battery Voltage=${bvolt} Percent=${bperc}"
if [ $bperc -gt 5 ];
then
echo "Rebooting Touchpad ..."
ssh -i ssh-key [email protected] "(sleep 1;/sbin/reboot -f) &"
echo "ALL DONE."
exit 0
fi
if [ $bperc -gt 0 ];
then
echo "Rebooting Touchpad ..."
ssh -i ssh-key [email protected] "(sleep 1;/sbin/reboot -f) &"
echo "Connect touchpad to stock HP AC charger to allow to charge"
echo "ALL DONE."
exit 0
fi
echo ""
echo "Waiting 1 min before checking voltage/percent again (1/2) ..."
sleep 60
bvolt=`ssh -i ssh-key [email protected] cat /sys/devices/i2c-3/3-0031/getvoltage`
if [ $? -ne 0 ];
then
echo "getvoltage failed"
echo "Aborted."
exit 1
fi
bperc=`ssh -i ssh-key [email protected] cat /sys/devices/i2c-3/3-0031/getpercent`
if [ $? -ne 0 ];
then
echo "getpercent failed"
echo "Aborted."
exit 1
fi
echo "Battery Voltage=${bvolt} Percent=${bperc}"
echo ""
echo "Waiting 1 min before checking voltage/percent again (2/2) ..."
sleep 60
bvolt=`ssh -i ssh-key [email protected] cat /sys/devices/i2c-3/3-0031/getvoltage`
if [ $? -ne 0 ];
then
echo "getvoltage failed"
echo "Aborted."
exit 1
fi
bperc=`ssh -i ssh-key [email protected] cat /sys/devices/i2c-3/3-0031/getpercent`
if [ $? -ne 0 ];
then
echo "getpercent failed"
echo "Aborted."
exit 1
fi
echo "Battery Voltage=${bvolt} Percent=${bperc}"
echo "Rebooting Touchpad ..."
ssh -i ssh-key [email protected] "(sleep 1;/sbin/reboot -f) &"
echo "Connect Touchpad to stock HP AC charger now"
echo "and allow it to charge for several hours"
echo "ALL DONE."
not working, im running 12.10 and the only way it works is if I gedit tpdebrick 12.10... but how should i type it? sudo gedit tpdebrick 12.10 ./tpdebrick 32 ???
Thank you.
signs of life !!!!!!!!!!!
miroxlava said:
#!/bin/sh
###################################
### TPDebrick v004 by jcsullins ###
###################################
check_pgms()
{
local have_other=1
local ok_install=0
local lsb_rel
local lsb_id
local SP
if ! `which perl >/dev/null 2>&1`;
then
echo "perl not found"
echo "Aborting."
exit 1
fi
lsb_rel=`lsb_release --short --release`
lsb_id=`lsb_release --short --id`
if [ -n "$lsb_rel" -a -n "${lsb_id}" -a "${lsb_id}" = "Ubuntu" ];
then
if [ "${lsb_rel}" = "11.04" -o "${lsb_rel}" = "11.10" -o "${lsb_rel}" = "12.04" ];
then
ok_install=1
fi
fi
if ! `which dfu-util >/dev/null 2>&1`;
then
echo "dfu-util not installed"
have_other=0
fi
if ! `which fastboot >/dev/null 2>&1`;
then
echo "fastboot not installed"
have_other=0
fi
if [ $have_other -eq 1 ];
then
return;
fi
if [ $ok_install -eq 0 ];
then
echo "Aborted."
exit 1
fi
if `which software-properties-kde >/dev/null 2>&1`;
then
SP=software-properties-kde
else
SP=software-properties-gtk
fi
echo "Installing dfu-util/fastboot ..."
$SP --enable-component universe
if [ $? -ne 0 ];
then
echo "Enable universe failed."
echo "Aborted."
exit 1
fi
add-apt-repository --yes ppa:nilarimogard/webupd8
if [ $? -ne 0 ];
then
echo "add-apt-repository failed"
echo "Aborted."
exit 1
fi
apt-get update
if [ $? -ne 0 ];
then
echo "apt-get update failed"
echo "Aborted."
exit 1
fi
apt-get --yes install dfu-util
if [ $? -ne 0 ];
then
echo "install dfu-util failed"
echo "Aborted."
exit 1
fi
apt-get --yes install android-tools-fastboot
if [ $? -ne 0 ];
then
echo "install fastboot failed"
echo "Aborted."
exit 1
fi
}
check_files()
{
local chk_list
local need_files=0
local doc_fn
local doc_fn_wifi="webosdoctorp305hstnhwifi.jar"
local doc_fn_3g="webosdoctorp305hstnhatt.jar"
echo "checking doc files ..."
chk_list="sbl1.mbn sbl2.mbn sbl3.mbn rpm.mbn tz.mbn"
chk_list="${chk_list} emmc_appsboot.mbn"
chk_list="${chk_list} bootie-topaz305.bin"
chk_list="${chk_list} PmA6Updater"
chk_list="${chk_list} a6_firmware.txt.00"
for fn in $chk_list
do
if [ ! -r ${fn} ];
then
need_files=1
fi
done
if [ $need_files -eq 0 ];
then
return
fi
if [ -r ../${doc_fn_wifi} ];
then
doc_fn=../${doc_fn_wifi}
fi
if [ -r ../${doc_fn_3g} ];
then
doc_fn=../${doc_fn_3g}
fi
if [ -z "${doc_fn}" ];
then
echo "could not find ../${doc_fn_wifi} or ../${doc_fn_3g}"
echo "Aborted."
exit 1
fi
echo "extracting doc files ..."
unzip -p "${doc_fn}" resources/webOS.tar \
| tar -xOf - ./nova-cust-image-topaz.rootfs.tar.gz \
| tar -xzOf - ./boot/boot-genesis.tar.gz \
| tar -xzf -
if [ $? -ne 0 ];
then
echo "failed to extract core bootloaders"
echo "Aborted."
exit 1
fi
unzip -p "${doc_fn}" resources/webOS.tar | \
tar -xOf - ./boot-topaz.bin \
>bootie-topaz305-raw.bin
if [ $? -ne 0 ];
then
echo "failed to extract boot.bin"
echo "Aborted."
exit 1
fi
PRINTF=`which printf 2>/dev/null`
if [ $? -ne 0 ];
then
echo "printf not found."
echo "Aborting."
exit 1
fi
$PRINTF "\x1C\xC3\x01\x00\x00\x00\x80\x40" >bootie-topaz305.bin
cat bootie-topaz305-raw.bin >>bootie-topaz305.bin
$PRINTF "\x18\xDA\x06\x15" >>bootie-topaz305.bin
unzip -p "${doc_fn}" resources/webOS.tar \
| tar -xOf - ./nova-cust-image-topaz.rootfs.tar.gz \
| tar -xzOf - ./usr/bin/PmA6Updater \
>PmA6Updater
if [ $? -ne 0 ];
then
echo "failed to extract PmA6Updater"
echo "Aborted."
exit 1
fi
chmod 755 PmA6Updater
unzip -p "${doc_fn}" resources/webOS.tar | tar -xOf - ./nova-cust-image-topaz.rootfs.tar.gz | tar -xzOf - ./lib/firmware/a6_firmware.txt.00 >a6_firmware.txt.00
if [ $? -ne 0 ];
then
echo "failed to extract a6_firmware.txt.00"
echo "Aborted."
exit 1
fi
}
check_config_files()
{
local cfgf=$1
echo -n "Checking that config/files are valid... "
if [ \! -r ${cfgf} ];
then
echo "FAILED"
echo "Cannot read config file ${cfgf}"
echo "Aborted."
exit 1
fi
while read fname pos md5
do
if [ "${fname}" = '#' ];
then
continue
fi
if [ \! -r "${fname}" ];
then
echo "FAILED"
echo "Cannot read file ${fname}"
echo "Aborted."
exit 1
fi
if [ "${md5}" = "nocheck" ];
then
continue;
fi
CHK_MD5=`md5sum ${fname} | cut -d' ' -f1`
if [ "${CHK_MD5}" != "${md5}" ];
then
echo "FAILED"
echo "File ${fname} failed check."
echo "Aborted."
exit 1
fi
done <${cfgf}
echo "OK"
}
load_files()
{
local cfgf=$1
while read fname pos md5
do
if [ "${fname}" = '#' ];
then
continue;
fi
echo "Writing file ${fname} ... "
addr=$(($pos * 512))
perl qdload.pl --laddr ${addr} --lfile ${fname}
if [ $? -ne 0 ];
then
echo "Cannot write file ${fname}"
echo "Aborted."
exit 1
fi
done <${cfgf}
echo "Done writing files."
}
check_usbdevs()
{
local tmout="$1"
shift
local dev_ids="$*"
local check_flag=1
while [ $check_flag -eq 1 ];
do
for dev_id in $dev_ids
do
dev_count=`lsusb | cut -d' ' -f6 | grep "^${dev_id}" | wc -l`
if [ $dev_count -gt 0 ];
then
return 0
fi
done
if [ $tmout -le 0 ];
then
check_flag=0
else
sleep 1
tmout=$((tmout - 1))
fi
done
return 1
}
get_usbdev_info()
{
local devid=$1
local field=$2
local filter=$3
if [ $field -eq 1 ];
then
lsusb -vv -d $devid |
while read a b c
do
if [ "x${a}" = "x${filter}" ];
then
echo "${b}"
return
fi
done
else
lsusb -vv -d $devid |
while read a b c
do
if [ "x${a}" = "x${filter}" ];
then
echo "${c}"
return
fi
done
fi
}
check_qdlmode()
{
local devid_qdl="05c6:9008"
local imanfac1="`get_usbdev_info $devid_qdl 1 iManufacturer`"
local imanfac2="`get_usbdev_info $devid_qdl 2 iManufacturer`"
local iprod1="`get_usbdev_info $devid_qdl 1 iProduct`"
local iprod2="`get_usbdev_info $devid_qdl 2 iProduct`"
if [ -z "${imanfac1}" -o -z "${iprod1}" ];
then
return 1
fi
if [ -z "${imanfac2}" -o -z "${iprod2}" ];
then
return 1
fi
if [ "${imanfac1}" != "3" ];
then
return 1
fi
if [ "${imanfac2}" != "Qualcomm, Incorporated" ];
then
return 1
fi
if [ "${iprod1}" != "2" ];
then
return 1
fi
if [ "${iprod2}" != "Qualcomm CDMA Technologies MSM" ];
then
return 1
fi
return 0
}
check_qdlmode2()
{
local devid_qdl="05c6:9008"
local imanfac1="`get_usbdev_info $devid_qdl 1 iManufacturer`"
local imanfac2="`get_usbdev_info $devid_qdl 2 iManufacturer`"
local iprod1="`get_usbdev_info $devid_qdl 1 iProduct`"
local iprod2="`get_usbdev_info $devid_qdl 2 iProduct`"
if [ -z "${imanfac1}" -o -z "${iprod1}" ];
then
return 1
fi
if [ -z "${imanfac2}" -o -z "${iprod2}" ];
then
return 1
fi
if [ "${imanfac1}" != "1" ];
then
return 1
fi
if [ "${imanfac2}" != "Qualcomm CDMA Technologies MSM" ];
then
return 1
fi
if [ "${iprod1}" != "2" ];
then
return 1
fi
if [ "${iprod2}" != "QHSUSB_DLOAD" ];
then
return 1
fi
return 0
}
#####
##### MAIN
#####
devid_qdl="05c6:9008"
if [ $# -ne 1 ];
then
echo "Usage: ${0} 16|32|64"
exit 1
fi
if [ "$1" != "16" -a "$1" != "32" -a "$1" != "64" ];
then
echo "Usage: ${0} 16|32|64"
exit 1
fi
tptype="$1"
if [ `id -u` -ne 0 ];
then
echo "Must run as superuser (i.e. sudo ...)"
echo "Aborting"
exit 1
fi
check_pgms
check_files
devid_qdl="05c6:9008"
devid_dfu="0830:8070"
devid_fastboot="18d1:d00d"
devid_netchip="0525:a4aa"
if `check_usbdevs 0 $devid_qdl`;
then
if ! `check_qdlmode2`;
then
echo "Incorrect QDL mode found."
echo "Please hold Power+Home+VolumeDown for 20-30 secs, then retry."
echo "Aborted."
exit 1
fi
else
echo "Connect Touchpad then hold Power+Home+VolumeDown for 30 seconds ..."
if ! `check_usbdevs 120 $devid_qdl`
then
echo "QDL mode not found"
echo "Aborting."
exit 1
else
echo "Release buttons now"
sleep 5
fi
fi
perl qdload.pl --pfile emmcbld.bin
if [ $? -ne 0 ];
then
echo "load of emmcbld.bin failed"
echo "Aborting."
exit 1
fi
sleep 3
echo "Checking QDL mode..."
if ! `check_qdlmode`;
then
echo "QDL second stage mode not found"
echo "Aborting"
exit 1
fi
load_files tp${tptype}nobootie.cfg
echo "Reseting device..."
perl qdload.pl --lreset
echo "Waiting for fastboot mode..."
if ! `check_usbdevs 60 ${devid_fastboot}`
then
echo "fastboot mode not found"
echo "Aborted."
exit 1
fi
echo "Loading TPToolbox-Headless ..."
fastboot flash bootmem TPToolbox-Headless-v004
if [ $? -ne 0 ];
then
echo "TPToolbox-Headless load failed"
echo "Aborted."
exit 1
fi
echo "Waiting for netchip mode... (may take 3+ mins)"
if ! `check_usbdevs 200 ${devid_netchip}`
then
echo "netchip mode not found"
echo "Aborted."
exit 1
fi
echo "Waiting for ping check... (may take 1-2 mins)"
ccnt=120
ping_ok=0
while [ $ccnt -gt 0 ];
do
ping -c 1 -W 1 192.168.7.7 >/dev/null 2>&1
if [ $? -eq 0 ];
then
ccnt=0
ping_ok=1
fi
ccnt=$(($ccnt - 1))
done
if [ $ping_ok -eq 0 ];
then
echo "ping check failed"
echo "check firewall/networking setup"
echo "access to the 192.68.7.7 host (Touchpad) failed"
echo "Aborted."
exit 1
fi
echo "Checking/updating known_hosts..."
need_khosts=0
if [ ! -r ~root/.ssh/known_hosts ];
then
need_khosts=1
else
chk1=`ssh-keygen -F 192.168.7.7 -f ~root/.ssh/known_hosts | wc -l`
if [ $? -ne 0 ];
then
echo "Failed to check known_hosts"
echo "Aborted."
exit 1
fi
if [ $chk1 -eq 0 ];
then
need_khosts=1
fi
fi
if [ $need_khosts -eq 1 ];
then
mkdir -p ~root/.ssh
cat khosts >>~root/.ssh/known_hosts
fi
echo "Copying A6 files..."
scp -i ssh-key a6_firmware.txt.00 PmA6Updater [email protected]:/tmp
if [ $? -ne 0 ];
then
echo "A6 files copy failed."
echo "Aborted."
exit 1
fi
echo "Copying bootloader files..."
scp -i ssh-key bootie-topaz305.bin emmc_appsboot.mbn [email protected]:/tmp
if [ $? -ne 0 ];
then
echo "bootloader files copy failed."
echo "Aborted."
exit 1
fi
echo ""
echo "Checking A6 firmware..."
ssh -i ssh-key [email protected] /tmp/PmA6Updater -x -d 0 /tmp/a6_firmware.txt.00
## if [ $? -ne 0 ];
## then
## echo "A6 firmware check failed."
## echo "Aborted."
## exit 1
## fi
echo ""
echo "Updating A6 firmware..."
ssh -i ssh-key [email protected] /tmp/PmA6Updater -f -d 0 /tmp/a6_firmware.txt.00
if [ $? -ne 0 ];
then
echo "A6 firmware update failed."
echo "Aborted."
exit 1
fi
echo ""
echo "Capturing DMESG..."
ssh -i ssh-key [email protected] dmesg
if [ $? -ne 0 ];
then
echo "dmesg capture failed"
echo "Aborted."
exit 1
fi
echo ""
echo "Updating bootloader emmc_appsboot..."
ssh -i ssh-key [email protected] dd if=/tmp/emmc_appsboot.mbn of=/dev/mmcblk0p7
if [ $? -ne 0 ];
then
echo "update bootloader emmc_appsboot failed."
echo "Aborted."
exit 1
fi
echo ""
echo "Updating bootloader bootie..."
ssh -i ssh-key [email protected] dd if=/tmp/bootie-topaz305.bin of=/dev/mmcblk0p8
if [ $? -ne 0 ];
then
echo "update bootloader bootie failed."
echo "Aborted."
exit 1
fi
echo ""
echo "Checking battery voltage/percent... "
bvolt=`ssh -i ssh-key [email protected] cat /sys/devices/i2c-3/3-0031/getvoltage`
if [ $? -ne 0 ];
then
echo "getvoltage failed"
echo "Aborted."
exit 1
fi
bperc=`ssh -i ssh-key [email protected] cat /sys/devices/i2c-3/3-0031/getpercent`
if [ $? -ne 0 ];
then
echo "getpercent failed"
echo "Aborted."
exit 1
fi
echo "Battery Voltage=${bvolt} Percent=${bperc}"
if [ $bperc -gt 5 ];
then
echo "Rebooting Touchpad ..."
ssh -i ssh-key [email protected] "(sleep 1;/sbin/reboot -f) &"
echo "ALL DONE."
exit 0
fi
if [ $bperc -gt 0 ];
then
echo "Rebooting Touchpad ..."
ssh -i ssh-key [email protected] "(sleep 1;/sbin/reboot -f) &"
echo "Connect touchpad to stock HP AC charger to allow to charge"
echo "ALL DONE."
exit 0
fi
echo ""
echo "Waiting 1 min before checking voltage/percent again (1/2) ..."
sleep 60
bvolt=`ssh -i ssh-key [email protected] cat /sys/devices/i2c-3/3-0031/getvoltage`
if [ $? -ne 0 ];
then
echo "getvoltage failed"
echo "Aborted."
exit 1
fi
bperc=`ssh -i ssh-key [email protected] cat /sys/devices/i2c-3/3-0031/getpercent`
if [ $? -ne 0 ];
then
echo "getpercent failed"
echo "Aborted."
exit 1
fi
echo "Battery Voltage=${bvolt} Percent=${bperc}"
echo ""
echo "Waiting 1 min before checking voltage/percent again (2/2) ..."
sleep 60
bvolt=`ssh -i ssh-key [email protected] cat /sys/devices/i2c-3/3-0031/getvoltage`
if [ $? -ne 0 ];
then
echo "getvoltage failed"
echo "Aborted."
exit 1
fi
bperc=`ssh -i ssh-key [email protected] cat /sys/devices/i2c-3/3-0031/getpercent`
if [ $? -ne 0 ];
then
echo "getpercent failed"
echo "Aborted."
exit 1
fi
echo "Battery Voltage=${bvolt} Percent=${bperc}"
echo "Rebooting Touchpad ..."
ssh -i ssh-key [email protected] "(sleep 1;/sbin/reboot -f) &"
echo "Connect Touchpad to stock HP AC charger now"
echo "and allow it to charge for several hours"
echo "ALL DONE."
not working, im running 12.10 and the only way it works is if I gedit tpdebrick 12.10... but how should i type it? sudo gedit tpdebrick 12.10 ./tpdebrick 32 ???
Click to expand...
Click to collapse
booted into ubuntu 12.04 cd, script worked, home button lit up, now on charger, will post results tomorrow.... im happy again (i think):laugh:
It's aliiiivvvveeeee!!!!!!
miroxlava said:
booted into ubuntu 12.04 cd, script worked, home button lit up, now on charger, will post results tomorrow.... im happy again (i think):laugh:
Click to expand...
Click to collapse
i couldnt get it to work with ubuntu 12.10 usb, but with one try on 12.04 CD.... my TP was up and running this morning, I felt like a kid on Xmas!!!
ThanX JC!!!!!!:good:
britoso said:
You are plugged in to a usb port and holding the 3 buttons for 20+ seconds right? Maybe you can leave it on the charger for a day first.
The one I fixed was dead for almost a year. the script failed to read the battery level.
Click to expand...
Click to collapse
Question: Where does the script read the battery level?
hi-phile said:
Question: Where does the script read the battery level?
Click to expand...
Click to collapse
will have to check the script for that.

Addon.d script for Xposed NOUGAT to survive dirty flashes

The script has been adapted for CM13: https://forum.xda-developers.com/xposed/addon-d-script-xposed-to-survive-cm13-t3268520
Since many things have been changed to get Xposed working on Nougat I guess this script has to be adapted again.
Please share if you find something
Thank you.
I second this. The addon.d script was a godsend in the good 'ol days
Something as this?:
Code:
#!/sbin/sh
#
#
# /system/addon.d/81-Xposed.sh
# During a LineageOS 14.1 upgrade, this script backs up Xposed framework files.
# /system is formatted and reinstalled, then the files are restored.
# Based on Xposed "flash-script.sh" script and https://forum.xda-developers.com/xposed/addon-d-script-xposed-to-survive-cm13-t3268520
export C=/sdcard/xposed_backupdir-1234
backup_file() {
if [ -e "$1" ]; then
if [ ! -L "$1" ]; then
local F="${1##*/}"
local D="${1%/*}"
mkdir -p "$C/$D"
cp -dp "$1" "$C/$D/$F"
else
ui_print "Skipping symbolic link $1"
fi
else
ui_print "NE: $1"
fi
}
restore_file() {
local FILE="${1##*/}"
local DIR="${1%/*}"
if [ -e "$C/$DIR/$FILE" ]; then
if [ "$FILE" == "xposed.prop" ] || [ "$FILE" == "XposedBridge.jar" ]; then
restore_nobackup "/$DIR/$FILE" 0 0 0644
elif [ "$FILE" == "app_process64_xposed" ] || [ "$FILE" == "app_process32_xposed" ]; then
restore_and_link "/$DIR/${FILE%_xposed}" 0 2000 0755 u:object_r:zygote_exec:s0
elif [ "$FILE" == "dex2oat" ] || [ "$FILE" == "patchoat" ]; then
restore_overwrite "/$DIR/$FILE" 0 2000 0755 u:object_r:dex2oat_exec:s0
elif [ "$FILE" == "oatdump" ]; then
restore_overwrite "/$DIR/$FILE" 0 2000 0755
else
restore_overwrite "/$DIR/$FILE" 0 0 0644
fi
else
ui_print "NE: $C/$DIR/$FILE"
fi
}
cp_perm() {
cp -f "$1" "$2" || exit 1
set_perm "$2" $3 $4 $5 $6
}
set_perm() {
chown $2:$3 "$1" || exit 1
chmod $4 "$1" || exit 1
if [ "$5" ]; then
chcon $5 "$1" 2>/dev/null
else
chcon 'u:object_r:system_file:s0' "$1" 2>/dev/null
fi
}
restore_nobackup() {
cp_perm "$C/$1" "$1" $2 $3 $4 $5
}
restore_and_link() {
TARGET="${1}"
XPOSED="${1}_xposed"
BACKUP="${1}_original"
if [ ! -f "$C/$XPOSED" ]; then
return
fi
cp_perm "$C/$XPOSED" "$XPOSED" $2 $3 $4 $5
if [ ! -f "$BACKUP" ]; then
mv "$TARGET" "$BACKUP" || exit 1
ln -s "$XPOSED" "$TARGET" || exit 1
chcon -h 'u:object_r:system_file:s0' "$TARGET" 2>/dev/null
fi
}
restore_overwrite() {
TARGET=$1
BACKUP="${1}.orig"
NO_ORIG="${1}.no_orig"
if [ ! -f "$TARGET" ]; then
touch "$NO_ORIG" || exit 1
set_perm "$NO_ORIG" 0 0 600
elif [ -f "$BACKUP" ]; then
rm -f "$TARGET"
gzip "$BACKUP" || exit 1
set_perm "${BACKUP}.gz" 0 0 600
elif [ ! -f "${BACKUP}.gz" ] && [ ! -f "$NO_ORIG" ]; then
mv "$TARGET" "$BACKUP" || exit 1
gzip "$BACKUP" || exit 1
set_perm "${BACKUP}.gz" 0 0 600
fi
cp_perm "$C/$TARGET" "$TARGET" $2 $3 $4 $5
}
ui_print() {
echo -n -e "ui_print $1\n" >> /proc/self/fd/$OUTFD
echo -n -e "ui_print\n" >> /proc/self/fd/$OUTFD
}
list_files() {
cat <<EOF
/system/xposed.prop
/system/framework/XposedBridge.jar
# For 32bits
/system/bin/app_process32_xposed
/system/bin/dex2oat
/system/bin/oatdump
/system/bin/patchoat
/system/lib/libart.so
/system/lib/libart-compiler.so
/system/lib/libart-disassembler.so
/system/lib/libsigchain.so
/system/lib/libxposed_art.so
# For 64bits
/system/bin/app_process64_xposed 64bit
/system/lib64/libart.so 64bit
/system/lib64/libart-compiler.so 64bit
/system/lib64/libart-disassembler.so 64bit
/system/lib64/libsigchain.so 64bit
/system/lib64/libxposed_art.so 64bit
EOF
}
OSA="32bit"
OUTFD=`ps | grep -v grep | grep -oE "update(.*)" | cut -d" " -f3`
API=$(sed -n "s/^ro.build.version.sdk=//p" /system/build.prop | head -n 1)
ABILONG=$(sed -n "s/^ro.product.cpu.abi=//p" /system/build.prop | head -n 1)
if [ "$API" -ge "21" ]; then
if [ "$ABILONG" = "arm64-v8a" ] || [ "$ABILONG" = "x86_64" ]; then OSA="64bit"; fi;
fi
case "$1" in
backup)
ui_print "Starting to backup Xposed"
list_files | while read FILE ARCH; do
echo $FILE | grep -q '^#'
if [ $? -ne 0 ]; then
if [ $ARCH ] && [ "$ARCH" != "$OSA" ]; then continue; fi;
backup_file "$FILE"
fi
done
ui_print "Ending to backup Xposed"
;;
restore)
ui_print "Starting to restore Xposed"
list_files | while read FILE ARCH; do
echo $FILE | grep -q '^#'
if [ $? -ne 0 ]; then
if [ $ARCH ] && [ "$ARCH" != "$OSA" ]; then continue; fi;
restore_file "$FILE"
fi
done
if [ "$API" -ge "22" ]; then
find /system /vendor -type f -name '*.odex.gz' 2>/dev/null | while read f; do mv "$f" "$f.xposed"; done
fi
rm -rf "${C:?}/"
ui_print "Ending to restore Xposed"
;;
pre-backup)
# Stub
;;
post-backup)
# Stub
;;
pre-restore)
# Stub
;;
post-restore)
# Stub
;;
esac
MariferC said:
Something as this?:
Code:
#!/sbin/sh
#
#
# /system/addon.d/81-Xposed.sh
# During a LineageOS 14.1 upgrade, this script backs up Xposed framework files.
# /system is formatted and reinstalled, then the files are restored.
# Based on Xposed "flash-script.sh" script and https://forum.xda-developers.com/xposed/addon-d-script-xposed-to-survive-cm13-t3268520
export C=/sdcard/xposed_backupdir-1234
backup_file() {
if [ -e "$1" ]; then
if [ ! -L "$1" ]; then
local F="${1##*/}"
local D="${1%/*}"
mkdir -p "$C/$D"
cp -dp "$1" "$C/$D/$F"
else
ui_print "Skipping symbolic link $1"
fi
else
ui_print "NE: $1"
fi
}
restore_file() {
local FILE="${1##*/}"
local DIR="${1%/*}"
if [ -e "$C/$DIR/$FILE" ]; then
if [ "$FILE" == "xposed.prop" ] || [ "$FILE" == "XposedBridge.jar" ]; then
restore_nobackup "/$DIR/$FILE" 0 0 0644
elif [ "$FILE" == "app_process64_xposed" ] || [ "$FILE" == "app_process32_xposed" ]; then
restore_and_link "/$DIR/${FILE%_xposed}" 0 2000 0755 u:object_r:zygote_exec:s0
elif [ "$FILE" == "dex2oat" ] || [ "$FILE" == "patchoat" ]; then
restore_overwrite "/$DIR/$FILE" 0 2000 0755 u:object_r:dex2oat_exec:s0
elif [ "$FILE" == "oatdump" ]; then
restore_overwrite "/$DIR/$FILE" 0 2000 0755
else
restore_overwrite "/$DIR/$FILE" 0 0 0644
fi
else
ui_print "NE: $C/$DIR/$FILE"
fi
}
cp_perm() {
cp -f "$1" "$2" || exit 1
set_perm "$2" $3 $4 $5 $6
}
set_perm() {
chown $2:$3 "$1" || exit 1
chmod $4 "$1" || exit 1
if [ "$5" ]; then
chcon $5 "$1" 2>/dev/null
else
chcon 'u:object_r:system_file:s0' "$1" 2>/dev/null
fi
}
restore_nobackup() {
cp_perm "$C/$1" "$1" $2 $3 $4 $5
}
restore_and_link() {
TARGET="${1}"
XPOSED="${1}_xposed"
BACKUP="${1}_original"
if [ ! -f "$C/$XPOSED" ]; then
return
fi
cp_perm "$C/$XPOSED" "$XPOSED" $2 $3 $4 $5
if [ ! -f "$BACKUP" ]; then
mv "$TARGET" "$BACKUP" || exit 1
ln -s "$XPOSED" "$TARGET" || exit 1
chcon -h 'u:object_r:system_file:s0' "$TARGET" 2>/dev/null
fi
}
restore_overwrite() {
TARGET=$1
BACKUP="${1}.orig"
NO_ORIG="${1}.no_orig"
if [ ! -f "$TARGET" ]; then
touch "$NO_ORIG" || exit 1
set_perm "$NO_ORIG" 0 0 600
elif [ -f "$BACKUP" ]; then
rm -f "$TARGET"
gzip "$BACKUP" || exit 1
set_perm "${BACKUP}.gz" 0 0 600
elif [ ! -f "${BACKUP}.gz" ] && [ ! -f "$NO_ORIG" ]; then
mv "$TARGET" "$BACKUP" || exit 1
gzip "$BACKUP" || exit 1
set_perm "${BACKUP}.gz" 0 0 600
fi
cp_perm "$C/$TARGET" "$TARGET" $2 $3 $4 $5
}
ui_print() {
echo -n -e "ui_print $1\n" >> /proc/self/fd/$OUTFD
echo -n -e "ui_print\n" >> /proc/self/fd/$OUTFD
}
list_files() {
cat <<EOF
/system/xposed.prop
/system/framework/XposedBridge.jar
# For 32bits
/system/bin/app_process32_xposed
/system/bin/dex2oat
/system/bin/oatdump
/system/bin/patchoat
/system/lib/libart.so
/system/lib/libart-compiler.so
/system/lib/libart-disassembler.so
/system/lib/libsigchain.so
/system/lib/libxposed_art.so
# For 64bits
/system/bin/app_process64_xposed 64bit
/system/lib64/libart.so 64bit
/system/lib64/libart-compiler.so 64bit
/system/lib64/libart-disassembler.so 64bit
/system/lib64/libsigchain.so 64bit
/system/lib64/libxposed_art.so 64bit
EOF
}
OSA="32bit"
OUTFD=`ps | grep -v grep | grep -oE "update(.*)" | cut -d" " -f3`
API=$(sed -n "s/^ro.build.version.sdk=//p" /system/build.prop | head -n 1)
ABILONG=$(sed -n "s/^ro.product.cpu.abi=//p" /system/build.prop | head -n 1)
if [ "$API" -ge "21" ]; then
if [ "$ABILONG" = "arm64-v8a" ] || [ "$ABILONG" = "x86_64" ]; then OSA="64bit"; fi;
fi
case "$1" in
backup)
ui_print "Starting to backup Xposed"
list_files | while read FILE ARCH; do
echo $FILE | grep -q '^#'
if [ $? -ne 0 ]; then
if [ $ARCH ] && [ "$ARCH" != "$OSA" ]; then continue; fi;
backup_file "$FILE"
fi
done
ui_print "Ending to backup Xposed"
;;
restore)
ui_print "Starting to restore Xposed"
list_files | while read FILE ARCH; do
echo $FILE | grep -q '^#'
if [ $? -ne 0 ]; then
if [ $ARCH ] && [ "$ARCH" != "$OSA" ]; then continue; fi;
restore_file "$FILE"
fi
done
if [ "$API" -ge "22" ]; then
find /system /vendor -type f -name '*.odex.gz' 2>/dev/null | while read f; do mv "$f" "$f.xposed"; done
fi
rm -rf "${C:?}/"
ui_print "Ending to restore Xposed"
;;
pre-backup)
# Stub
;;
post-backup)
# Stub
;;
pre-restore)
# Stub
;;
post-restore)
# Stub
;;
esac
Click to expand...
Click to collapse
Did you create it? Did you try it on Nougat?
Anyway my custom ROM is no longer updated for Nougat. Hopefully it will work on Oreo.
OSheden said:
Did you create it? Did you try it on Nougat?
Anyway my custom ROM is no longer updated for Nougat. Hopefully it will work on Oreo.
Click to expand...
Click to collapse
Yes I've created it.
Yes I've tested on Nougat (LineageOS 14.1) on a Xiaomi Mi4 and a Moto G 2014, and it works.

Badly made antivirus script I created

Bash:
#This script is satire. This is, like, the worst antivirus ever.
tput setaf 2
echo "Welcome to Web Antivirus."
echo "Make sure you are running this from a live Linux image as the root user."
lsblk
echo "Select your Windows drive: "
read drive
mount $drive /mnt
cd /mnt/Windows/system32/etc
wget https://github.com/T145/black-mirror/releases/download/latest/black_domain.txt >> /dev/null
wget https://github.com/T145/black-mirror/releases/download/latest/black_ipv4.txt >> /dev/null
echo "Downloaded blacklists."
cp hosts.txt hosts.txt.bak
mawk '{print "0.0.0.0 " $0}' black_domain.txt >> hosts.txt
echo "Wrote domain blacklist."
mawk '{print "0.0.0.0 " $0}' black_ipv4.txt >> hosts.txt
echo "Wrote IPv4 blacklist"
rm -f black_domain.txt black_ipv4.txt
echo "Deleted temporary files."
cd /mnt
echo "@echo off" > clean.bat
echo "del %userprofile%\\Downloads\\*.exe" >> clean.bat
echo "Created cleaner script."
echo "Put this in Task Scheduler so it runs at regular intervals."
echo "Options:"
echo "Type \"restore\" to restore original /etc/hosts."
echo "Type \"exit\" to leave."
echo "Select an option: "
alias restore="rm -f hosts.txt && mv hosts.txt.bak hosts.txt"
read option
$option

Categories

Resources