Testsign tool ! - Android Q&A, Help & Troubleshooting

Hi guys !
This my first little tool i'm build for resign zipfiles and apkfiles for linux users.
Unzip the testsign_tool.zip to your home directory,inside you will find a little howto.
Sorry for bad english.
Enjoy

1. you can use ~/ instead of /home/username/
2. you can use $USER instead of username
3. you left a hidden file .kopia in the scripts folder.
4. you assume that everybody has testsign.jar in his sdk folder, why not include it with this tool?
other than that, nice tool

Well this is my first script,must start somewhere

thank you .. good work ... it would have bin nice to include the jar file but hey thats what google is for right thanks thou

OK, I'm having a problem getting it to work. Here's what I did: I changed my sdk folder to androidsdk. I unzipped the testsign_tool to my androidsdk/tool folder. I edited the scripts to:
for zipfile script:
Code:
lear
echo
#
#set -x
#
file_date=$(date +%Y%m%d%H%M%S)
# Dir with signed file
working_dir="~/$USER/testsign_tool/update"
# directory that contains update.zip
zip_dir="../working"
jpath="~/$USER/androidsdk/tools/sign/testsign.jar"
cd $working_dir
java -classpath $jpath testsign $zip_dir/update.zip ${file_date}_file-signed.zip
if [ -f $working_dir/${file_date}_file-signed.zip ] ; then
echo "New file signed!"
sleep 2
exit 0
else
echo "Error, please check."
fi
and for apkfile script:
Code:
clear echo
#
#set -x
#
file_date=$(date +%Y%m%d%H%M%S)
# Dir with signed file
working_dir="~/$USER/testsign_tool/update"
# directory that contains update.apk
apk_dir="../working"
jpath="~/$USER/androidsdk/tools/sign/testsign.jar"
cd $working_dir
java -classpath $jpath testsign $apk_dir/update.apk ${file_date}_file-signed.apk
if [ -f $working_dir/${file_date}_file-signed.apk ] ; then
echo "New file signed!"
sleep 2
exit 0
else
echo "Error, please check."
fi
so that $USER will allow anyone to use without modifying the scripts with their own name. I renamed my Launcher.apk to update.apk.
I place the update.apk into the working folder from within the testsign_tool folder. I double click the menu.sh and select option 2 in order to resign/sign my new apk. After this I get a message in terminal saying:
Code:
scripts/do_apkfile: line 13: cd: ~/treken/testsign_tool/update: No such file or directory
Exception in thread "main" java.lang.NoClassDefFoundError: testsign
Caused by: java.lang.ClassNotFoundException: testsign
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
Could not find the main class: testsign. Program will exit.
Error, please check.
Press Enter to continue
any insight to my problem as to what I did wrong?

No version for windows? only for linux?

Related

[DEV] [HACK] Maemo 5 via VNC (UPDATE)

This hasn't been thoroughly tested as i'm on a Desire and have issues getting Ubuntu to start up due to some kernel issues regarding loopback devices but this should (Theoretically ) work.
If you'd like to test this out you have to first use the following tutorial
http://forum.xda-developers.com/showthread.php?t=718952
Then replace the ubuntu.img of that package with this... (I kept the .img named ubuntu.img so as to alleviate the need to modify the bootubuntu chroot script)
http://www.multiupload.com/CO5NRRKN80
Post back here if it works.
I've attached a file with the five scripts that you need to boot this .img. Do NOT download the package in the first thread as that is for ubuntu.
In short...
1. Create a folder on the root of your sdcard called ubuntu
2. Extract both scripts.rar and ubuntu.rar in that folder
3. Follow the tutorial as posted in the first thread that I linked.
Upon performing sh ./ubuntu.sh and bootubuntu with new ubuntu.img, i received the following:
Code:
Ubuntu Chroot Bootloader v0.1
Ubuntu Bootloader is now installed!
This process does NOT damage Android OS!
Original Installer by Charan Singh
Modified for Ubuntu Chroot by Max Lee at NexusOneHacks.net
To enter the Debian Linux console just type 'bootubuntu'
# bootubuntu
mknod: /dev/loop2: File exists
mount: can't setup loop device: No such file or directory
mount: mounting devpts on /data/local/mnt/dev/pts failed: No such file or directory
mount: mounting proc on /data/local/mnt/proc failed: No such file or directory
mount: mounting sysfs on /data/local/mnt/sys failed: No such file or directory
net.ipv4.ip_forward = 1
Setting /etc/resolv.conf to Google Open DNS 8.8.8.8 and 8.8.4.4
bootubuntu: cannot create /data/local/mnt/etc/resolv.conf: directory nonexistent
bootubuntu: cannot create /data/local/mnt/etc/resolv.conf: directory nonexistent
Setting localhost on /etc/hosts
bootubuntu: cannot create /data/local/mnt/etc/hosts: directory nonexistent
READY TO ROCK AND ROLL BABY!
Brought to you by NexusOneHacks.net and the open source community!
chroot: can't execute '/bin/bash': No such file or directory
Shutting down Ubuntu
umount: can't umount /data/local/mnt/dev/pts: No such file or directory
umount: can't umount /data/local/mnt/proc: No such file or directory
umount: can't umount /data/local/mnt/sys: No such file or directory
umount: can't umount /data/local/mnt: Invalid argument
#
So ur saying replace the Ubuntu img nd replace it with what u posted maemo 5? N how how I boot then
Su
Su
Bootubuntu?
Sent from my Nexus One using XDA App
got a loop /dev/loop1:no such devices or address
lemme try these new scripts..
got this
# su
# bootubuntu
failed: No such file or directoryk3 on /system
mknod: not found
mount: not found
mount: not found
mount: not found
mount: not found
sysctl: not found
Setting /etc/resolv.conf to Google Open DNS 8.8.8.8 and 8.8.4.4
: directory nonexistentte /data/local/mnt
: directory nonexistentte /data/local/mnt
Setting localhost on /.etc/hosts
: directory nonexistentte /data/local/mnt
READY TO ROCK AND ROLL BABY!
Brought to you by NexusOneHacks.net and the open source community!
chroot: not found
: not found
: not found
Shutting down Ubuntu but when i replace them with my old ubuntu files, ubuntu runs fine on or off the computer...mayb make this directory /data/local/mnt?
Yes, su su bootubuntu
I think I may need to make a slight modification to together boot script. Bear with me.
http://forum.xda-developers.com/attachment.php?attachmentid=359312&d=1279019428
Updated scripts.
Has anyone tried the new scripts yet?
Edit: double post...
I Did, i re-ran sh ./ubuntu.sh and then just in case, ran su su twice, then ran bootubuntu. results:
Code:
Ubuntu Chroot Bootloader v0.1
Ubuntu Bootloader is now installed!
This process does NOT damage Android OS!
Original Installer by Charan Singh
Modified for Ubuntu Chroot by Max Lee at NexusOneHacks.net
To enter the Debian Linux console just type 'bootubuntu'
# su
# su
# bootubuntu
failed: No such file or directoryk3 on /system
mknod: not found
mount: not found
mount: not found
mount: not found
mount: not found
sysctl: not found
Setting /etc/resolv.conf to Google Open DNS 8.8.8.8 and 8.8.4.4
: directory nonexistentte /data/local/mnt
: directory nonexistentte /data/local/mnt
Setting localhost on /.etc/hosts
: directory nonexistentte /data/local/mnt
READY TO ROCK AND ROLL BABY!
Brought to you by NexusOneHacks.net and the open source community!
chroot: not found
: not found
: not found
Shutting down Ubuntu
umount: not found
umount: not found
umount: not found
umount: not found
#
cmonnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn
It would be really good if we can modify the scripts so we are able to still run ubuntu and maemo5 don't you guys think?

Batch APK Installer

I found this Windows application on this thread http://forum.xda-developers.com/showthread.php?p=23291051 I think its a valuable software to install all our apk in one time to save time after each ROM flash.
Windows? Owwww. I have linux mint. imo I don't like windows
sent from my x8 running sde ROM
Click THANKS if I helped
wilbso said:
Windows? Owwww. I have linux mint. imo I don't like windows
Click to expand...
Click to collapse
Let me help you with a very basic script then...
Code:
#!/bin/sh
for apk in `ls $1 | grep .apk`
do
adb install $apk
done
Copy/Paste into gedit, save in, for example, ~/bin, as apkbatch, make the script executable.
For example, run it as...
apkbatch ~/Android/APKs
Of course this is just a skeleton ... you could refine the script with:
- a check to see if adb even exists in the search path
- a check if adb is already running or not - and if not starting it up
- checking back with the user about to either WiFi connect or USB connect
Hint: Modify and extend the skeleton script from above to learn a bit about shell scripting and surprise us with a fully-fledged APK batch installer script for Linux.
APK batch installer
Based on B.Jay's answer, I believe the best thing for linux is to do this.
install android-tools-adb, nautilus-actions
Save the following code to $HOME/bin/apk_batch_install and make it executable.
Code:
#!/bin/sh
which adb || { notify-send 'Please install android-tools-adb before using this script.' ; exit 1; }
echo "APK install log:" > /tmp/apk_batch_install_log
echo "" >> /tmp/apk_batch_install_log
count=1
(
adb start-server
echo "#Waiting for device ..."
adb wait-for-device
for file in "[email protected]"
do
echo "#Installing $count/$#: $(basename "$file")"
adb install "$file" 1>> /tmp/apk_batch_install_log
echo "" >> /tmp/apk_batch_install_log
count=$(( count+1 ))
echo "$(echo "scale=0; $count*100/$#" | bc)"
done
) | zenity --progress \
--title="APK installation" \
--text="Starting adb server ..." --percentage=0 --auto-close --no-cancel
notify-send "APK installation completed"
zenity --info --text="$(cat /tmp/apk_batch_install_log)"
rm /tmp/apk_batch_install_log
and use "Nautilus Actions" to put it to context menu.
After that just select the files you want to install -> right click -> APK install !!
To configure "Nautilus Actions"
1) Add new Action
2) Name it "APK install"
Command Tab
3) Command Path: /home/.../bin/apk_batch_install
4) Command Parameters: %F
Mimetype Tab
5) Add a mimetype filter with mimetype: application/vnd.android.package-archive
6) Remove the filter with * in mimetype
Save
Well done for reviving a year old thread
Sent from my X8 using xda app-developers app
Can anyone write an .sh script so i can use it on android device to install apk from storage
Thanks in advance
Kellwa said:
Can anyone write an .sh script so i can use it on android device to install apk from storage
Thanks in advance
Click to expand...
Click to collapse
Why would you need one? Simply use the relevant xposed module to suppress install notifications and click through them once.

[Q] adb works but not extract-files.sh

I am trying to extract vendor files from an i8730 phone using extract-files.sh
I have Linux Mint 14 with android-tools-adb installed as the adb
adb works fine to a point
[email protected] ~ $ adb devices
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
List of devices attached
333398202BDF00EC device
adb shell and ls shows files on the phone including the vendor folder
If I run ls from my working directly I can see extract-files.sh
Think the solution is in .bashrc but believe I am not doing it right. When I run extract-files.sh I get this
[email protected] ~ $ ./extract-files.sh
bash: ./extract-files.sh: Permission denied
[email protected] ~ $ sudo extract-files.sh
[sudo] password for megan:
sudo: extract-files.sh: command not found
[email protected] ~ $ sudo./extract-files.sh
bash: sudo./extract-files.sh: No such file or directory
location adb shows
/usr/share/doc/android-tools-adb
location bashrc shows
/etc/bash.bashrc
I have edit bashrc
[email protected] ~ $ sudo gedit /etc/bash.bashrc
[sudo] password for megan:
Have added this to the end
export PATH=${PATH}:/home/megan/usr/share/doc/android-tools-adb
Think this is where I have gone wrong. Any suggestions?
Thanks
Bazzan
http://forum.xda-developers.com/showpost.php?p=7146410&postcount=5
unable to create 99-android.rules
MoonBlade said:
http://forum.xda-developers.com/showpost.php?p=7146410&postcount=5
Click to expand...
Click to collapse
Thanks MoonBlade. Think you are suggesting the version on the link so have been working through it. Had to source the files elsewhere as original link is dead. May or may not be a problem.
Got as far as creating the file in /etc/udev/rules.d/ but am unable to create a file in that folder. I am logged in as root. I can view the folder through GUI but not able to create 99-android.rules
Get this mess in terminal
[email protected] ~ $ su
Password:
megan-901 megan # cd /etc/udev/rules.d/
megan-901 rules.d # ls
Traceback (most recent call last):
File "/usr/lib/command-not-found", line 21, in <module>
os.execvp("python3", [sys.argv[0]] + sys.argv)
File "/usr/lib/python2.7/os.py", line 344, in execvp
_execvpe(file, args)
File "/usr/lib/python2.7/os.py", line 380, in _execvpe
func(fullname, *argrest)
OSError: [Errno 2] No such file or directory
megan-901 rules.d #
Not sure the above is anything to do with not being able to write to that folder. Any ideas?
Bazzan
ok im not sure exactly what youre trying to do but it sounds like you want to get files from your phones /vendor/ directory and copy them to a directory on your computer. if this is correct then you need to stop playiing around with your .bashrc and your $PATH appends. all you need to use is adb
you dont have to adb shell. once you run adb shell it opens up a terminal inside your device so if youre trying to run a shell script on your computer from inside an adb shell it just wont work.
a simpler way to put this is, if you want to get /vendor/firmware/bcm4329.bin from your phone and put it on your computer in a folder on your desktop you would run it like this
$adb pull /vendor/firmware/bcm4329.bin /home/megan/Desktop/phonevendorfirmware/bcm439.bin
and the directory and file will automatically be created on your computer. from there you can do what ever you wanted to do to the files that you pulled from the phone.
the same works in reverse if you want to move a file to the phone using $adb push
bazzan said:
[email protected] ~ $ ./extract-files.sh
bash: ./extract-files.sh: Permission denied
Click to expand...
Click to collapse
You need to give execution permissions to the script, this way:
Code:
chmod +x extract-files.sh
And then, run your script like this (if the script doesn't need root permissions, run it without sudo):
Code:
sudo ./extract-files.sh
Many thanks haxin and RoberGalarga
I was given the extract-files.sh by a developer to extract vendor files for ROM development - i8730. He did not have the phone (I don't at the moment as has been wrapped for the kids to give to me for my birthday - practicing on an a Galaxy S)
From peeking inside the file it looks like a batch file that grabs all the content from the vendor folder. Did SQL 10 years ago and looks like that. Essentially does what you gave me haxim, but pulls the content of the entire folder. What is the best way to do that with adb pull?
Gave chmod +x extract-files.sh a try.
Without sudo I get
bash:./extract-files.sh : /bin/sh^M: bad interpreter: No such file or directory
With sudo
sudo: unable to execute ./extract-files.sh: No such file or directory.
Remember I am running this against a i9000, not the phone that I was given the sh file to run against. Get that back the begining of September. Not sure if that makes a difference but if it does not obvious to me.Seems to be falling over on the first line as that appears in the non sudo error message.
Have copied the content of extract-files.sh below.
Thanks again guys. Learning heaps and loving it.
Bazzan
#!/bin/sh
set -e
export DEVICE=express
export VENDOR=samsung
if [ $# -eq 0 ]; then
SRC=adb
else
if [ $# -eq 1 ]; then
SRC=$1
else
echo "$0: bad number of arguments"
echo ""
echo "usage: $0 [PATH_TO_EXPANDED_ROM]"
echo ""
echo "If PATH_TO_EXPANDED_ROM is not specified, blobs will be extracted from"
echo "the device using adb pull."
exit 1
fi
fi
BASE=../../../vendor/$VENDOR/$DEVICE/proprietary
rm -rf $BASE/*
for FILE in `egrep -v '(^#|^$)' ../$DEVICE/proprietary-files.txt`; do
echo "Extracting /system/$FILE ..."
DIR=`dirname $FILE`
if [ ! -d $BASE/$DIR ]; then
mkdir -p $BASE/$DIR
fi
if [ "$SRC" = "adb" ]; then
adb pull /system/$FILE $BASE/$FILE
else
cp $SRC/system/$FILE $BASE/$FILE
fi
done
./setup-makefiles.sh
Where did you get the script? This error:
bazzan said:
bash:./extract-files.sh : /bin/sh^M: bad interpreter: No such file or directory
Click to expand...
Click to collapse
is caused by a bad formatting in the file (Window$ editing... pfff....), so, make a new file using Gedit and paste this directly (don't copy&paste from the original script!!):
bazzan said:
#!/bin/sh
set -e
export DEVICE=express
export VENDOR=samsung
if [ $# -eq 0 ]; then
SRC=adb
else
if [ $# -eq 1 ]; then
SRC=$1
else
echo "$0: bad number of arguments"
echo ""
echo "usage: $0 [PATH_TO_EXPANDED_ROM]"
echo ""
echo "If PATH_TO_EXPANDED_ROM is not specified, blobs will be extracted from"
echo "the device using adb pull."
exit 1
fi
fi
BASE=../../../vendor/$VENDOR/$DEVICE/proprietary
rm -rf $BASE/*
for FILE in `egrep -v '(^#|^$)' ../$DEVICE/proprietary-files.txt`; do
echo "Extracting /system/$FILE ..."
DIR=`dirname $FILE`
if [ ! -d $BASE/$DIR ]; then
mkdir -p $BASE/$DIR
fi
if [ "$SRC" = "adb" ]; then
adb pull /system/$FILE $BASE/$FILE
else
cp $SRC/system/$FILE $BASE/$FILE
fi
done
Click to expand...
Click to collapse
Delete the old file, and try the new one (you can use any filename, it doesn't matter).
Many thanks RoberGalarga.
Got the script off a recognised developer along with proprietary-files.txt and setup-makefiles.sh
He is working a CWM and a rom for owners of the i8730 - he does not have the phone so community feed in content. Get the impression he is not a Windows user (he did not have a Windows script for this) so reckon I might have corrupted it.
I did as you advised and made some real progress. Now we get the following:
[email protected] ~ $ sudo ./extract-files.sh
[sudo] password for megan:
egrep: ../express/proprietary-files.txt: No such file or directory
: not foundefiles.sh: 3: ./setup-makefiles.sh:
: Directory nonexistentk ./setup-makefiles.sh: cannot create ../../../vendor/samsung/express
[email protected] ~ $
It breaks further down the script. In the home folder there is proprietary-files.txt which list the files to be extracted along with their file path. Does that message indicate it is looking for proprietary-files.txt in /home/express?
Setup-makefiles.sh is in the home folder as well and appears to be a Cyanogenmod Project file to create a blob from the the results of extract-files.sh
Bazzan
bazzan said:
Does that message indicate it is looking for proprietary-files.txt in /home/express?
Click to expand...
Click to collapse
Yes, that's it. Check again, seems like something is missing yet.
Thanks again. Got it to work by building the folder structure
/home/vendor/Samsung/express
And then running the files from there
Bazzan

Extract files and permissions help?

Hi guys,
I'm trying to make some changes to an android box firmware. Ultimately what I'm trying to do is extract some files from a tar.gz into a folder on the root.
I have got as far as creating the directory on the root, and having a shell script run that extracts the files to the root folder. Problem is, the files aren't appearing in my folder.
This is what I've done so far:
1. Extracted the boot image in the firmware to edit "init.rc". I've made the changes so I can make my "test" folder with 777 permissions.
In the "on init" section of init.rc I have this:
Code:
mkdir /test 777
2. I've created the following script (test.h) that runs from init.amlogic.board.rc
Code:
#!/system/bin/sh
MARK=/data/local/test
if [ ! -e $MARK ]; then
echo "test script"
busybox tar -zxf /system/test.tar.gz -C /test/
touch $MARK
echo "OK, installation complete."
fi
This is the code in the init.amlogic.board.rc
Code:
service test_copy /system/bin/test.sh
user root
group root
disabled
oneshot
on property:sys.boot_completed=1
start test_copy
Once the box has booted I can see the "test_copy" file but the tar.gz files are not in my root folder.
The last thing I need is the files from the tar.gz to be 777 permissions.
Obviously I'm a complete noob at this, hope that makes sense and someone can help?

XCOPY - Batch to copy directorys by drag and drop and dont loose directory tree or files propertys.

Hi!
So i create a simple batch so like that we can copy a directory by drag and drop to any location.
Nothing expecial untill now but, the bacth do this:
Spoiler: Copy Options
If Source is a directory or contains wildcards and Destination does not exist, xcopy assumes Destination specifies a directory name and creates a new directory. Then, xcopy copies all specified files into the new directory. By default, xcopy prompts you to specify whether Destination is a file or a directory.
Copies directories and subdirectories.
Copies all subdirectories, even if they are empty.
Verifies each file as it is written to the destination file to make sure that the destination files are identical to the source files.
Copies files and retains the read-only attribute on Destination files if present on the Source files. By default, xcopy removes the read-only attribute.
Copies files with read-only attribute.
Copies files with hidden and system file attributes. By default, xcopy does not copy hidden or system files.
Copies file ownership and discretionary access control list (DACL) information.
Copies file audit settings and system access control list (SACL) information (implies /o).
Copies files without buffering. Recommended for very large files.
Like this we can do full copy with full tree and files attributes.
Batch works like Drag and drop over the batch and only will request to write/paste destination.
This is the batch:
Spoiler: Xcopy_Full_directory.bat
Code:
@echo off & @echo.
:: BatchGotAdmin
:-------------------------------------
REM --> Check for permissions
IF "%PROCESSOR_ARCHITECTURE%" EQU "amd64" (
>nul 2>&1 "%SYSTEMROOT%\SysWOW64\cacls.exe" "%SYSTEMROOT%\SysWOW64\config\system"
) ELSE (
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
)
REM --> If error flag set, we do not have admin.
if '%errorlevel%' NEQ '0' (
@echo. & @echo [31mRequesting administrative privileges...[0m
goto UACPrompt
goto UACPrompt
) else ( goto gotAdmin )
:UACPrompt
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
set params= %*
echo UAC.ShellExecute "cmd.exe", "/c ""%~s0"" %params:"=""%", "", "runas", 1 >> "%temp%\getadmin.vbs"
"%temp%\getadmin.vbs"
del "%temp%\getadmin.vbs"
exit /B
:gotAdmin
rem :To CD to the location of the batch script file (%0)
CD /d "%~dp0"
for %%a in (%*) do (
set "Sname=%~$PATH:1"
set "Dname=%~n1"
set /p root=" Write destination root here: "
)
@echo.
Xcopy /i /s /e /v /f /k /r /h /o /x /j "%Sname%" "%root%\%Dname%"
pause
I created so like this i can copy the files from Windows 11 that are in pendrived created by Media Creation Tool without lossing files propertys.
I hope this helps you to!
@jenneh check this bat, maybe helps you with something.
@persona78 You have no idea how much your posts have helped me. Some people do not understand that there are those of us that learn differently and are brand new, so you taking the time helps weirdos like me learn :>

Categories

Resources