Run bash script app - Android Q&A, Help & Troubleshooting

I' m trying to run a bash script.
I have a script and that script download 3 other scripts, and then, run them.
The first script, is the script where downloading 3 other scripts and running them.
The second script, is an example of the 3 other scripts.
So, which is the easiest way to do that ?
Is there any application where can do that ?
I use these scripts on android tv boxes.
The tv boxes are not rooted.
Also, i have an error with "wget: bad address"
Bash:
#!/bin/bash
wget http://domain.com/files/script_1.sh -O /sdcard/scripts/script_1.sh
sleep 1;
wget http://domain.com/files/script_2.sh -O /sdcard/scripts/script_2.sh
sleep 1;
wget http://domain.com/files/script_3.sh -O /sdcard/scripts/script_3.sh
sleep 1;
sh ./sdcard/scripts/script_1.sh
sleep 1;
sh ./sdcard/scripts/script_2.sh
sleep 1;
sh ./sdcard/scripts/script_3.sh
notify-send "Finish"
exit
Bash:
#!/bin/bash
wget https://domain.com/files/name.txt -O /sdcard/scripts/1.txt
cat 1.txt | cut -c10- | awk -F "/a/" '{print $1}' | awk -F "/word" '{print $1}' | awk 'NR == 2' > 1_.txt
a=$(cat 1_.txt) && sed -i "[email protected]\(.*/a/\).*\(/word/.*m\)@\1$a\[email protected]" /sdcard/scripts/file/filename1
sleep 2 ;
wget https://domain.com/files/name.txt -O /sdcard/scripts/2.txt
cat 2.txt | cut -c10- | awk -F "/a/" '{print $1}' | awk -F "/word" '{print $1}' | awk 'NR == 2' > 2_.txt
b=$(cat 2_.txt) && sed -i "[email protected]\(.*/a/\).*\(/word/.*m\)@\1$b\[email protected]" /sdcard/scripts/file/filename2
sleep 2 ;
find /sdcard/scripts/file/ -name "*.m" -printf '%T+ %p\n' | sort -r | xargs cat > /sdcard/scripts/file/filename.new
sleep 1 ;
sed -i '1i word' /sdcard/scripts/file/filename.new
sed -i '2i word' /sdcard/scripts/file/filename.new
sed -i '3i word' /sdcard/scripts/file/filename.new
sed -i '4i word' /sdcard/scripts/file/filename.new

domain.com is a web hosting site, so your http:// link is wrong - it needs to be your actual website
wget http://domain.com/files/script_1.sh -O /sdcard/scripts/script_1.sh

DSA said:
domain.com is a web hosting site, so your http:// link is wrong - it needs to be your actual website
wget http://domain.com/files/script_1.sh -O /sdcard/scripts/script_1.sh
Click to expand...
Click to collapse
Sorry, i forgot to say that the "domain.com" is an example. I use correct domain in my script. Just i hide it in post, because i wouldn't to share it.
The script in linux works fine.

May be the WGET what is implemented in your Android OS is faulty.
Here a workaround was shown.

jwoegerbauer said:
May be the WGET what is implemented in your Android OS is faulty.
Here a workaround was shown.
Click to expand...
Click to collapse
Didn't work. Same error
"wget: bad address"

Related

Two versions of the same app

Is it possible to install two versions of the same app without overwriting the previous one??
i have tried to decompile the app and change the app name in package field of manif
est.xml, i was successful in installing the apps but the one with unedited manifest.xml works whereas the other force closes
This is possible, but you will need to adjust the folders containing the smali files (after using apktool), as well as (not sure about this bit) changing the class declaration names in each smali file.
It's complex, but it is possible to do and you're on the right tracks with the package name
is there any automated tool to do all that?
keyboardcowboy said:
is there any automated tool to do all that?
Click to expand...
Click to collapse
Unlikely
10 char
I have seen Brut's modified Google maps, it can be installed beside original app...How did he do it?
keyboardcowboy said:
is there any automated tool to do all that?
Click to expand...
Click to collapse
Someone could make a script. I'll post my solution to give that person a head start.
Code:
apktool d -f base_MYAPP.apk base_MYAPP
mv base_MYAPP/smali/com/MYCOMPANY/MYAPP base_MYAPP/smali/com/MYCOMPANY/NEW_MYAPP
find base_MYAPP/smali/com/MYCOMPANY/NEW_MYAPP -name "*.smali" -print | xargs sed -i -e 's/MYAPP/NEW_MYAPP/g'
sed -i -e 's/MYAPP/NEW_MYAPP/g' base_MYAPP/AndroidManifest.xml
sed -i -e 's/APP NAME/APP NAME NEW/g' base_MYAPP/res/values/strings.xml
rm -f base_MYAPP/res/values/strings.xml-e base_MYAPP/AndroidManifest.xml-e
find base_MYAPP/smali/com/MYCOMPANY/NEW_MYAPP -name "*.smali-e" -print | xargs rm -f
apktool b base_MYAPP NEW_MYAPP-unaligned.apk
jarsigner -keystore my.keystore -storepass pass1 -keypass pass2 NEW_MYAPP-unaligned.apk alias
zipalign -f -v 4 NEW_MYAPP-unaligned.apk NEW_MYAPP.apk
Something like that. I need to go home. =)
awesome
Try something like this:
Code:
#!/bin/bash
##### Constants
APK_NAME="My App"
PACKAGE="My_App"
PACKAGE_PATH=com/my_company/
KEYSTORE="my.keystore"
KEYSTORE_PASS="keystore_pass"
ALIAS="alias_name"
ALIAS_PASS="alias_pass"
##### Functions
function copy_apk
{
# Parameters
base_file=$1
new_package=$2
new_apk_name=$3
input_dir=base/
file_modification_date=$(stat -f "%Sm" -t "%Y%m%d" $input_dir/$base_file)
file_modification_time=$(stat -f "%Sm" -t "%H%M%S" $input_dir/$base_file)
output_dir=$file_modification_date/
# Variables
file_name=$(echo "$base_file" | cut -d'.' -f1)
file_extension=$(echo "$base_file" | cut -d'.' -f2)
new_file_name_unaligned="${file_name}-unaligned.${file_extension}"
new_file_name_aligned="${file_name}_${file_modification_date}_${file_modification_time}.${file_extension}"
work_directory=$input_dir$file_name/
smali_directory=$work_directory/smali/$PACKAGE_PATH/
# Function Body
mkdir -p $input_dir
mkdir -p $output_dir
apktool d -f $input_dir$base_file $work_directory
mv $smali_directory/$PACKAGE $smali_directory/$new_package
find $smali_directory/ -name "*.smali" -print | xargs sed -i -e "s/$PACKAGE/$new_package/g"
find $smali_directory/ -name "*.smali-e" -print | xargs rm -f
find $work_directory/ -name "*.xml" -print | xargs sed -i -e "s/$PACKAGE/$new_package/g"
sed -i -e "s/$APK_NAME/$new_apk_name/g" $work_directory/res/values/strings.xml
find $work_directory/ -name "*.xml-e" -print | xargs rm -f
apktool b $work_directory $input_dir/$new_file_name_unaligned
jarsigner -keystore $KEYSTORE -storepass $KEYSTORE_PASS -keypass $ALIAS_PASS $input_dir/$new_file_name_unaligned $ALIAS
zipalign -f 4 "$input_dir/$new_file_name_unaligned" "$output_dir/$new_file_name_aligned"
}
function apk_version
{
# Parameters
base_file=$1
package_extension=$2
# Variables
new_package="${PACKAGE}_${package_extension}"
new_apk_name="${APK_NAME} $package_extension"
# Function Body
$(copy_apk "$base_file" "$new_package" "$new_apk_name")
}
##### Main
$(apk_version my_app_sandbox.apk Sandbox)
$(apk_version my_app_release.apk Release)
sgeos said:
Try something like this:
Code:
#!/bin/bash
##### Constants
APK_NAME="My App"
PACKAGE="My_App"
PACKAGE_PATH=com/my_company/
KEYSTORE="my.keystore"
KEYSTORE_PASS="keystore_pass"
ALIAS="alias_name"
ALIAS_PASS="alias_pass"
##### Functions
function copy_apk
{
# Parameters
base_file=$1
new_package=$2
new_apk_name=$3
input_dir=base/
file_modification_date=$(stat -f "%Sm" -t "%Y%m%d" $input_dir/$base_file)
file_modification_time=$(stat -f "%Sm" -t "%H%M%S" $input_dir/$base_file)
output_dir=$file_modification_date/
# Variables
file_name=$(echo "$base_file" | cut -d'.' -f1)
file_extension=$(echo "$base_file" | cut -d'.' -f2)
new_file_name_unaligned="${file_name}-unaligned.${file_extension}"
new_file_name_aligned="${file_name}_${file_modification_date}_${file_modification_time}.${file_extension}"
work_directory=$input_dir$file_name/
smali_directory=$work_directory/smali/$PACKAGE_PATH/
# Function Body
mkdir -p $input_dir
mkdir -p $output_dir
apktool d -f $input_dir$base_file $work_directory
mv $smali_directory/$PACKAGE $smali_directory/$new_package
find $smali_directory/ -name "*.smali" -print | xargs sed -i -e "s/$PACKAGE/$new_package/g"
find $smali_directory/ -name "*.smali-e" -print | xargs rm -f
find $work_directory/ -name "*.xml" -print | xargs sed -i -e "s/$PACKAGE/$new_package/g"
sed -i -e "s/$APK_NAME/$new_apk_name/g" $work_directory/res/values/strings.xml
find $work_directory/ -name "*.xml-e" -print | xargs rm -f
apktool b $work_directory $input_dir/$new_file_name_unaligned
jarsigner -keystore $KEYSTORE -storepass $KEYSTORE_PASS -keypass $ALIAS_PASS $input_dir/$new_file_name_unaligned $ALIAS
zipalign -f 4 "$input_dir/$new_file_name_unaligned" "$output_dir/$new_file_name_aligned"
}
function apk_version
{
# Parameters
base_file=$1
package_extension=$2
# Variables
new_package="${PACKAGE}_${package_extension}"
new_apk_name="${APK_NAME} $package_extension"
# Function Body
$(copy_apk "$base_file" "$new_package" "$new_apk_name")
}
##### Main
$(apk_version my_app_sandbox.apk Sandbox)
$(apk_version my_app_release.apk Release)
Click to expand...
Click to collapse
this is fun, but I am not sure how to runt he script on my phone.

need help to translate MIUI V4 (ICS)

Hi,
i tried to translate a MIUI for Galaxy Nexus rom into french (can also be an other language)
i wrote an unix script to automate the process.
What i do is quite simple:
i get a specific MIUI V4 version for my device and the same translated version for the nexus S (because the nexus S has a french version)
i decompile each apk from the french rom, an put the french files into to decompile galaxy nexus directories
i recompile each apk
and i copy the compiled resources into the origin galaxy nexus apks
and i build the new ROM
but i get a bootloop any ideas ?
here is my script
if there are any part of this script that isn't clear, i could try to explain them.
of course this script could also be used on other device or other translation with some changes.
Thanks in advance .
Code:
#!/bin/bash
# MIUI-FRENCH TRANSLATE SCRIPT FOR GNEX V1.0 By Alain57
BASE_DIR=$PWD
FRENCH_DIR=$BASE_DIR/french_rom
ORIGINAL_DIR=$BASE_DIR/original_rom
OUTPUT_ROM_DIR=$BASE_DIR/output_rom
OUT_DIR=$BASE_DIR/out
WORK_DIR=$BASE_DIR/workdir
ORIGIN_APK_DIR=$WORK_DIR/origin
TRANSLATION_DIR=$WORK_DIR/translation
DECODED_APK_DIR=$WORK_DIR/decoded
LOG_FILE=$BASE_DIR/log.txt
TEMP_DIR=$BASE_DIR/temp
# clean the log file and create the missing directories if they don't exist (for exemple on first run)
function cleanLog(){
rm -fr $LOG_FILE
ARRAY_DIR=( $FRENCH_DIR $ORIGINAL_DIR $OUTPUT_ROM_DIR $OUT_DIR $WORK_DIR $ORIGIN_APK_DIR $TRANSLATION_DIR $DECODED_APK_DIR $TEMP_DIR )
echo "creating missing directoriesi if needed"
for DIR in ${ARRAY_DIR[@]}; do
if [ ! -d $DIR ]; then
mkdir $DIR
fi
done
}
# configure apktool to use framework-res and framework-miui-res
function setFramework(){
cd $FRENCH_DIR
echo "<- apktool if system/framework/framework-res.apk ->" >> $LOG_FILE
apktool if framework-res.apk >> $LOG_FILE 2>&1
echo "<- apktool if system/framework/framework-miui-res.apk ->" >> $LOG_FILE
apktool if framework-miui-res.apk >> $LOG_FILE 2>&1
}
#decompile all apk file from the english Gnex miui rom
function decompileOriginFiles(){
cd $ORIGINAL_DIR
COUNT_ORIGINAL_ZIP=`ls . | grep '.zip' | wc -l`
if [ "$COUNT_ORIGINAL_ZIP" -eq "1" ]; then
mv *.zip en.zip
echo "unzip the original rom"
unzip -q -o en.zip
echo "copy the apks to the origin dir"
cp -a system/framework/*.apk $ORIGIN_APK_DIR
cp -a system/app/*apk $ORIGIN_APK_DIR
cd $ORIGIN_APK_DIR
for F in *.apk; do
echo "decompiling origianl file $F ..." | tee -a $LOG_FILE
apktool d $F $DECODED_APK_DIR/${F%.apk} >> $LOG_FILE 2>&1
done
else
echo "there need to be ONE zip file in the original directory"
exit
fi
}
# decompile all apk files from the french Nexus S ROM
function decompileTranslatedFiles(){
cd $FRENCH_DIR
COUNT_FRENCH_ZIP=`ls . | grep '.zip' | wc -l`
if [ "$COUNT_FRENCH_ZIP" -eq "1" ]; then
mv *.zip fr.zip
echo "unzip the french rom"
unzip -q -o fr.zip
setFramework
echo "copy the apks to the working dir"
cp -a system/framework/*.apk $WORK_DIR
cp -a system/app/*.apk $WORK_DIR
cd $WORK_DIR
for F in *.apk; do
echo "decompiling french file $F ..." | tee -a $LOG_FILE
apktool d $F $TRANSLATION_DIR/${F%.apk} >> $LOG_FILE 2>&1
done
else
echo "there neeed to be ONE zip file in the french directory"
exit
fi
}
# Delete the given directory, because it is not needed
function deleteDirectoryWithoutTranslation(){
echo " ---> directory useless, removed"
cd $TRANSLATION_APK_DIR
rm -fr $1
}
# delete all useless data from the french apks
function cleanTranslatedFiles(){
cd $TRANSLATION_DIR
for d in *; do
echo "cleaning the directory $d"
cd $TRANSLATION_DIR/$d
if [ -d "res" ]; then
ls . | grep -v res | xargs -o rm -fr
cd "res"
CONTAINS_FRENCH_TRANSLATION=`ls .| grep '\-fr' | wc -l`
if [ "$CONTAINS_FRENCH_TRANSLATION" -eq "0" ]; then
deleteDirectoryWithoutTranslation $d
else
echo "---> transltation here, clean it"
ls . | grep -v '\-fr\|\./\|\.\./' | xargs -o rm -fr
fi
else
echo "no res directory"
deleteDirectoryWithoutTranslation $d
fi
if [ ! -f $ORIGIN_APK_DIR/$d.apk ];then
echo "directory not in original rom $d"
deleteDirectoryWithoutTranslation $d
fi
done
}
# merge the decoded translation in the decoded english files
function mergeTranslations(){
cd $DECODED_APK_DIR
mv $TRANSLATION_DIR/* .
cd $WORK_DIR
rm -f *.apk
}
# compile new apks including french files
function compileApk(){
cd $ORIGIN_APK_DIR
for f in *.apk; do
echo "compiling $f"
echo "apktool b $DECODED_APK_DIR/${f%.apk} $WORK_DIR/$f"
apktool b $DECODED_APK_DIR/${f%.apk} $WORK_DIR/$f >> $LOG_FILE 2>&1
done
}
# delete apk in work directory and put the original apks there
function deleteWorkFileAndCopyOriginalApk(){
cd $WORK_DIR
rm -f *.apk
cp -a $ORIGIN_APK_DIR/*.apk .
}
# put the compiled modified files in the original apk files
function finalMerge(){
cd $DECODED_APK_DIR
for F in *.apk; do
echo "doing final build $F"
cd $TEMP_DIR
rm -fr *
unzip -q $DECODED_DIR/$F
ls . | grep -v 'res\|classes.dex\|resources.arsc\|\./\|\.\./' | xargs -o rm -fr
if [ -d res ]; then
cd res
ls . | grep -v '\-fr\|\./\|\.\./' | xargs -o rm -fr
HAS_FR=`ls . | grep '\-fr' | wc -l`
if [ "$HAS_FR" -eq "0" ]; then
cd ..
rm -fr res
else
cd ..
fi
fi
zip -r $WORK_DIR/$F *
done
}
#replace the english apk files with the new french apk files, change the build.prop value and create an unsigned zip that can be flashed
function createRom(){
cd $OUTPUT_ROM_DIR
mv $ORIGINAL_DIR/system $ORIGINAL_DIR/boot.img $ORIGINAL_DIR/META-INF .
mv $WORK_DIR/*.apk system/app
mv system/app/framework*.apk system/framework
mv system/build.prop build.prop
sed 's/=en/=fr/g' build.prop > build1.prop
rm -f build.prop
sed 's/=US/=FR/g' build1.prop > system/build.prop
rm -f build1.prop
zip -r $BASE_DIR/new_rom.zip *
}
cleanLog
decompileTranslatedFiles
decompileOriginFiles
cleanTranslatedFiles
mergeTranslations
compileApk
deleteWorkFileAndCopyOriginalApk
finalMerge
createRom
Questions or Problems Should Not Be Posted in the Development Forum
Please Post in the Correct Forums & Read the Forum Rules
Moving to Q&A

[Q] debian, webtopMOD and post #865

Re: [MOD] Full Linux (Debian) inside WebTop! v0.2.7
I managed to unlock, root and install WebTopMOD on my new2me searet Atrix 4g. Great feeling for an android n00b! I can run iceweasel, gimp and whatever I like just like any linux distro on the webtop as long as I start a new shell to launch linux apps. I had wanted to continue on to using the instructions in post #865 by jissee44 to get the xfce4 window manager running. No luck! I can launch (I think) xfce4 manually and the entire view changes - new wallpaper, new toolbar, but no access to the linux filesystem - everything connects to the android filesystem.
Here is what I think is needed to see what went wrong. There are only two files to edit when following post #865. I am including the entire file as the posting I was following does not include diffs.
/osh/usr/sbin/linux
Code:
#!/bin/bash
CHROOTDIR="/osh/opt/WebTopMOD/root"
LOOPDEVICE="/dev/block/loop50"
function enablex {
xhost +
}
function mountlinuxdisk {
loopdevice
sudo mount -t ext3 -o loop=$LOOPDEVICE $FILENAME $CHROOTDIR
touch /tmp/linuxdiskactive
}
function umountlinuxdisk {
sudo umount $CHROOTDIR
sudo umount $LOOPDEVICE
rm /tmp/linuxdiskactive
}
function startfulllinuxchroot {
mountlinuxdisk
sudo mount -o bind /proc $CHROOTDIR/proc
sudo mount -o bind /dev $CHROOTDIR/dev
sudo mount -o bind /dev/pts $CHROOTDIR/dev/pts
sudo mount -o bind /dev/shm $CHROOTDIR/dev/shm
#sudo mount -o bind /proc/bus/usb $CHROOTDIR/proc/bus/usb
sudo mount -o bind /sys $CHROOTDIR/sys
sudo mount -o bind /tmp $CHROOTDIR/tmp
sudo mount -o bind /var/tmp $CHROOTDIR/var/tmp
sudo mount -o bind /var/run/dbus/ $CHROOTDIR/var/run/dbus
sudo mount -t vfat /dev/block/vold/179:18 $CHROOTDIR/sdcard
sudo mount -t vfat /dev/block/vold/179:33 $CHROOTDIR/sdcard-ext
sudo mount -o bind /etc $CHROOTDIR/mnt/DEVICE/etc
sudo mount -o bind /usr $CHROOTDIR/mnt/DEVICE/usr
touch /tmp/fulllinuxchrootactive
}
function startxterm {
# sudo chroot $CHROOTDIR /usr/bin/xterm pdmenu
sudo chroot $CHROOTDIR /usr/bin/xterm
}
function startxfce {
kill $(ps -ef | grep 5000 | grep webtop-wallpaper | cut -c10-15)
kill $(ps -ef | grep 5000 | grep xscreensaver | cut -c10-15
sudo chroot $CHROOTDIR /usr/bin/xfce4-session
}
function stopfullchroot {
CHECKS=0
until [ "$CHECKS" -eq "15" ]
do
TOUMOUNT=`sudo mount | grep "$CHROOTDIR" | awk '{ print $3 }'`
if [ "$TOUMOUNT" = "" ]; then break; fi
for i in $TOUMOUNT
do
sudo umount $i
done
CHECKS=$(( $CHECKS + 1 ))
done
rm /tmp/fulllinuxchrootactive
mountlinuxdisk
}
function checkwhereislinux {
if [ -e /sdcard/WebTopMOD/linuxdisk ]; then
FILENAME="/sdcard/WebTopMOD/linuxdisk"
if [ "$1" -eq 1 ]; then
/usr/bin/xmessage "Found image in /sdcard/WebTopMOD/linu
xdisk!"
checklinuxdisk
fi
else
if [ -e /sdcard-ext/WebTopMOD/linuxdisk ]; then
FILENAME="/sdcard-ext/WebTopMOD/linuxdisk"
if [ "$1" -eq 1 ]; then
/usr/bin/xmessage "Found image in /sdcard-ext/We
bTopMOD/linuxdisk!"
checklinuxdisk
fi
else
if [ "$1" -eq 1 ]; then
/usr/bin/xmessage "Sorry, no image available...
put linuxdisk in /sdcard/WebTopMOD/ OR /sdcard-ext/WebTopMOD/linuxdisk"
exit 1
fi
fi
fi
}
function checklinuxdisk {
if [ ! -s $FILENAME ]; then
/usr/bin/xmessage "But... Wait... Your disk looks damaged, maybe
you tried to copy an image larger then 4gB? This is a FAT32 limit."
exit 1
fi
if [ -d $FILENAME ]; then
/usr/bin/xmessage "Damn! linuxdisk is a file and it MUST be plac
ed in /sdcard/WebTopMOD/ OR /sdcard-ext/WebTopMOD/ folder. Otherwise this mod CA
N'T work' "
exit 1
fi
}
function loopdevice {
if [ -e $LOOPDEVICE ]; then
echo "Device exist"
else
sudo mknod -m600 $LOOPDEVICE b 7 50
fi
}
enablex
if [ -e /tmp/linuxdiskactive ]; then
if [ -e /tmp/fulllinuxchrootactive ]; then
startxterm
else
checkwhereislinux 0
startfulllinuxchroot
startxterm
fi
else
checkwhereislinux 1
mountlinuxdisk
startfulllinuxchroot
startxfce
# startxterm
fi
#RUNNINGXTERM=`ps -C xterm h | wc -l`
#if [ "$RUNNINGXTERM" -eq 0 ]
#then
# stopfullchroot
# umountlinuxdisk
#fi
exit 0
/osh/usr/local/bin/start-oshwt-2.sh
Code:
#! /bin/sh
### BEGIN INIT INFO
# Provides: start_lxde2.sh
# Required-Start:
# Required-Stop:
# Default-Start:
# Default-Stop:
# Short-Description: started by adas user at login
### END INIT INFO
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
export LD_LIBRARY_PATH=/usr/lib:/usr/local/lib
. /lib/lsb/init-functions
log_action_msg "Will now start OSHWT 2 scripts"
# start OSHWT 2 scripts
sfalv -i "lxpanel"
#sfalv -i "awn-autostart"
sfalv -i "webtop-panel"
sfalv -i "webtop-wallpaper"
sfalv -i "evbridge"
sfalv -i "window_switcher"
sr-test avahi_start &
Can someone give me some clues as to what has gone wrong? I'm not sure if something is missing or if I broke something in my edits, and there are no follow up questions on the post. There are 13 thanks.
ruarri
making progress?
Okay, I'm just hearing the crickets.
> startxfce4
provides some of the results I want, but leaves AWN in control. Now that the new ICS ROMs are coming out I'll have to see if I can just make webtopMOD usable until something better comes along. It would be good to see better documentation for n00bs. The forums are a little rambling. There is a lot of good info, its just scattered.
ruarri
ruarri said:
no access to the linux filesystem - everything connects to the android filesystem.
Click to expand...
Click to collapse
Hi,
What do you mean ?
The Debian is a Chroot
Good'nough
jisse44 said:
The Debian is a Chroot
Click to expand...
Click to collapse
Thanks for the terse explanation, jisse44. It took me a while to get around to reading the docs on chroot. It makes sense that webtop isrunning in a sandbox. That is inherently limiting.
I still love webtop and my lapdock. It will be interesting to see what happens with webtop and the ICS ROMs on the Atrix 4G.
ruarri said:
It will be interesting to see what happens with webtop and the ICS ROMs on the Atrix 4G.
Click to expand...
Click to collapse
Or not....
By now you can only run last new "webtop" on ICS Roms, and this is not THE webtop, it's a tablet mode: no Ubuntu or debian, only Android....

[Q] How to use string array in init.d script?

I want to make app symlinks to sd-ext on booting.
I made a short init.d script, And It correctly worked on JB based rom.
But after I downgraded to GB, It doesn't work anymore.
I founded that pure bone shell doesn't support arrays.
The script uses string array to declare apk list I want to symlink.
So is there a way to use string array or make similar effect?
Here is my script.
Code:
#!/system/bin/sh
if [ -z "$SD_EXT_DIRECTORY" ]; then SD_EXT_DIRECTORY=/sd-ext; fi
SYSBLOCK=`mount | grep system | cut -f 1 -d ' '`
sysapp2sd=("BackupRestoreConfirmation.apk" "BasicDreams.apk" "Bluetooth.apk" "CertInstaller.apk" "Calculator.apk" "CMFileManager.apk" "CMScreenshot.apk" "DSPManager.apk" "DrmProvider.apk" "Email.apk" "Email2.apk" "Exchange.apk" "Exchange2.apk" "Gmail.apk" "GoogleBackupTransport.apk" "InputDevices.apk" "Music.apk" "OneTimeInitializer.apk" "PhotoTable.apk" "PicoTts.apk" "SamsungTTS.apk" "SharedStorageBackup.apk" "SoundRecorder.apk" "Talk.apk" "ThemeChooser.apk" "ThemeManager.apk" "Torch.apk" "VpnDialogs.apk" "WAPPushManager.apk")
app2sd_exception=("com.UCMobile" "com.adobe.flashplayer" "com.android.lmt" "com.fiberthemax.OpQ2keyboard" "com.fiberthemax.OpQ2keyboard.dict.ko" "com.google.android.gms" "com.google.android.googlequicksearchbox" "com.jungsup.thecall" "com.mobint.hololauncher" "com.mobint.hololauncherplus" "com.mobitobi.android.gentlealarm" "com.myhome.mytheme" "com.rs.autorun" "com.teslacoilsw.launcher" "com.vladlee.callconfirm.free" "eu.chainfire.supersu" "kz.mek.DialerOne" "me.dennis.weather.naver" "net.dinglisch.android.taskerm" "net.everythingandroid.smspopup" )
# make sure $SD_EXT_DIRECTORY is actually mounted
if ! awk -vDIR="$SD_EXT_DIRECTORY" '$2 == DIR { exit 1; }' /proc/mounts ; then
mount -rw -o remount SYSBLOCK /system
mkdir -p /sd-ext/symlink/system/app
# /system/app/ -> /sd-ext/symlink/system/app/
FILES=`find /system/app -maxdepth 1 -type f`
for file in $FILES; do
filename=`basename $file`
for pattern in ${sysapp2sd[@]}; do
if [[ $filename == $pattern ]]; then
cp /system/app/$filename /sd-ext/symlink/system/app/
rm -f /system/app/$filename
ln -s /sd-ext/symlink/system/app/$filename /system/app/$filename
fi
done
done
# /data/app/ -> /sd-ext/symlink/data/app/
FILES=`find /data/app -maxdepth 1 -type f`
for file in $FILES; do
filename=`basename $file`
match=false
for pattern in ${app2sd_exception[@]}; do
if [[ $filename == $pattern* ]]; then
match=true
fi
done
if ! $match; then
cp /data/app/$filename /sd-ext/symlink/data/app/
rm -f /data/app/$filename
ln -s /sd-ext/symlink/data/app/$filename /data/app/$filename
fi
done
mount -r -o remount SYSBLOCK /system
fi
You can use echo or cat command to wrap list and grab it with awk.
and add another for loop over for loop for getting the counted numbers to be used on awk...

[Q] Leaving getevent without “-c count”

Hi,
for catching events I found:
http://forum.xda-developers.com/showthread.php?t=2233865
Now I want to build a shell were I can look for devices and then catch them and bind them to a action...
It's my first time I tried to write a shell script...
The script works if I don't have any devices witch sends continuously there daters:
Code:
#!/system/bin/sh
[...]
device1="/dev/input/event4"
device2="/dev/input/event0"
while :; do
getevent -q -t -c 2 | grep -e "$device1" -e "$device2" | while IFS=' ' read -r ev_t_brckt ev_time ev_path ev_type ev_code ev_value _; do #-r _ a; do
Mapping "${ev_path/:}" "$ev_code" "$ev_value" "$device1" "$device2"
done
Result="$?"
if [[ "$Result" == "11" ]] then
input keyevent 85 #KEYCODE_MEDIA_PLAY_PAUSE
fi
done
..mapping looks like:
Code:
Mapping() { # "${ev_path/:}" "$ev_code" "$ev_value" "$deviceX1" "$deviceX2" (...)
if [[ "$1" == "$4" && "$2" == "0139" && "$3" == "00000001" ]] then
return 11 #Play/Pause
fi
# (…) and so on
}
is there any way to write
Code:
getevent -q -t -c 2 | grep -e "$device1" -e "$device2" | while IFS=' ' read -r ev_t_brckt ev_time ev_path ev_type ev_code ev_value _; do #-r _ a; do
to
Code:
getevent -q -t | grep -e "$device1" -e "$device2" | while IFS=' ' read -r ev_t_brckt ev_time ev_path ev_type ev_code ev_value _; do #-r _ a; do
Mapping "${ev_path/:}" "$ev_code" "$ev_value" "$device1" "$device2"
if [ -n "$?" ]; then
>>>> exit / break /what ever
fi
done
I tried it with “exit”, “break” and “return” (and “kill $PID”) but getevent didn't want to exit :'(
any ideas?
(pleas be clement with my grammar.. it's not my native language )
kind regards, Veit

Categories

Resources