#!/bin/sh
run-standalone.sh dbus-send --type=method_call --dest=org.freedesktop.Notifications /org/freedesktop/Notifications org.freedesktop.Notifications.SystemNoteInfoprint string:"Welcome to MakeJadSHortcutter!"
sleep 2
JAR=$1
if [ ! -f "${JAR}" ]; then
run-standalone.sh dbus-send --type=method_call --dest=org.freedesktop.Notifications /org/freedesktop/Notifications org.freedesktop.Notifications.SystemNoteInfoprint string:"JAR file does not exist!" && sleep 3
echo "Usage: makejadsh JAR file";
exit 1
fi
JAD="${JAR%.*}.jad"
if [ -f "${JAD}" ]; then
echo -n "${JAD} already exists, overwrite the file? (Y/N) "
read tmpans
answer=$(echo "$tmpans" | tr '[:upper:]' '[:lower:]')
if [ "$answer" != "y" ] && [ "$answer" != "Y" ]; then
echo "Not overwriting ${JAD} file!"
else
rm -f "${JAD}"
fi
fi
if [ ! -f "${JAD}" ]; then
unzip -aa -j -p ${JAR} "META-INF/MANIFEST.MF" | sed -e '/^[ \t]*$/d' > "${JAD}"
echo "MIDlet-Jar-URL: ${JAR}" >> "${JAD}"
echo "MIDlet-Info-URL: http://" >> "${JAD}"
FILESIZE=$(stat "${JAR}")
echo "MIDlet-Jar-Size: ${FILESIZE}" >> "${JAD}"
echo "${JAD} file created!"
MIDLET_ICON=`grep "MIDlet-Icon: " $JAD | sed "s/\MIDlet-Icon://g" | sed 's/\///g' | sed 's/^[ \t]*//'`
MIDLET_NAME=`grep "MIDlet-Name: " $JAD | sed /MIDlet-Name:/s///`
UNZIP_ICON=`unzip "$JAR" "$MIDLET_ICON" -d /usr/share/icons/hicolor/scalable/hildon/`
RENAME_ICON=`mv "/usr/share/icons/hicolor/scalable/hildon/$MIDLET_ICON" "/usr/share/icons/hicolor/scalable/hildon/$MIDLET_NAME.png"`
fi
SH="${JAR%.*}.sh"
if [ -f "${SH}" ]; then
echo -n "${SH} Already exists, overwrite the file? (Y/N) "
read tmpans
answer=$(echo "$tmpans" | tr '[:upper:]' '[:lower:]')
if [ "$answer" != "y" ] && [ "$answer" != "Y" ]; then
echo "Not overwriting ${SH} file!"
else
rm -f "${SH}"
fi
fi
if [ ! -f "${SH}" ]; then
MAINCLASS=`cat $JAD | grep 'MIDlet-1:' | cut -d ',' -f 3`
READLINKJAR=`readlink -f $JAR`
echo '#!/bin/sh' > $SH
echo '' >> $SH
echo '/home/user/phoneme/bin/cvm -Xmx12m -Dmicroedition.profiles=MIDP-2.1 -Dsun.midp.library.name=midp -Dsun.midp.home.path=/home/user/phoneme/midp/midp_linux_fb_gcc -Dcom.sun.midp.mainClass.name=com.sun.midp.main.CdcMIDletSuiteLoader sun.misc.MIDPLauncher -suitepath' $READLINKJAR '-jadpath' $JAD -1 $MAINCLASS >> $SH
chmod a+x $SH
echo "${SH} file created!"
READLINK=`readlink -f $SH`
MIDLET_NAME=`grep "MIDlet-Name: " $JAD | sed /MIDlet-Name:/s///`
MIDLET_VERSION=`grep "MIDlet-Version: " $JAD | sed /MIDlet-Version:/s///`
echo -e "[Desktop Entry]
Encoding=UTF-8
Version=$MIDLET_VERSION
Type=Application
Name=$MIDLET_NAME
Exec=.$READLINK
X-Osso-Type=application/x-executable
Terminal=true
Icon=$MIDLET_NAME" | sudo tee /usr/share/applications/hildon/"$MIDLET_NAME".desktop
sleep 6
run-standalone.sh dbus-send --type=method_call --dest=org.freedesktop.Notifications /org/freedesktop/Notifications org.freedesktop.Notifications.SystemNoteInfoprint string:"Created! The $MIDLET_NAME shortcut is now on the Menu"
echo "$MIDLET_NAME added as a .desktop shortcut"
sleep 4 ; else
run-standalone.sh dbus-send --type=method_call --dest=org.freedesktop.Notifications /org/freedesktop/Notifications org.freedesktop.Notifications.SystemNoteInfoprint string:"Unable to create $MIDLET_NAME.desktop file, check the ownership and try again!"
sleep 2
echo "Unable to add $MIDLET_NAME added as a .desktop shortcut, check the ownership!"
fi
exit 0
| The Following User Says Thank You to santiago For This Useful Post: | ||
| The Following User Says Thank You to pedsarjon For This Useful Post: | ||
for the icon, i've got to quote the icon, give me one minute
i've not an emulator on my ubuntu pc, :'( i'm doing all from my device.. i'm back soon
| The Following User Says Thank You to DavyP For This Useful Post: | ||
#!/bin/sh
run-standalone.sh dbus-send --type=method_call --dest=org.freedesktop.Notifications /org/freedesktop/Notifications org.freedesktop.Notifications.SystemNoteInfoprint string:"Welcome to MakeJadSHortcutter!"
sleep 2
JAR=$1
if [ ! -f "${JAR}" ]; then
run-standalone.sh dbus-send --type=method_call --dest=org.freedesktop.Notifications /org/freedesktop/Notifications org.freedesktop.Notifications.SystemNoteInfoprint string:"JAR file does not exist!" && sleep 3
echo "Usage: makejadsh JAR file";
exit 1
fi
JAD="${JAR%.*}.jad"
if [ -f "${JAD}" ]; then
echo -n "${JAD} already exists, overwrite the file? (Y/N) "
read tmpans
answer=$(echo "$tmpans" | tr '[:upper:]' '[:lower:]')
if [ "$answer" != "y" ] && [ "$answer" != "Y" ]; then
echo "Not overwriting ${JAD} file!"
else
rm -f "${JAD}"
fi
fi
if [ ! -f "${JAD}" ]; then
unzip -aa -j -p ${JAR} "META-INF/MANIFEST.MF" | sed -e '/^[ \t]*$/d' > "${JAD}"
echo "MIDlet-Jar-URL: ${JAR}" >> "${JAD}"
echo "MIDlet-Info-URL: http://" >> "${JAD}"
FILESIZE=$(stat "${JAR}")
echo "MIDlet-Jar-Size: ${FILESIZE}" >> "${JAD}"
echo "${JAD} file created!"
MIDLET_ICON=`grep "MIDlet-Icon: " $JAD | sed "s/\MIDlet-Icon://g" | sed 's/\///g' | sed 's/^[ \t]*//'`
MIDLET_NAME=`grep "MIDlet-Name: " $JAD | sed /MIDlet-Name:/s///`
ICON_NAME=`grep "MIDlet-Name: " $JAD | sed /MIDlet-Name:/s/// | sed 's/^[ \t]*//' | sed 's/ //g'`
UNZIP_ICON=`unzip "$JAR" "$MIDLET_ICON" -d /usr/share/icons/hicolor/scalable/hildon/`
RENAME_ICON=`mv "/usr/share/icons/hicolor/scalable/hildon/$MIDLET_ICON" "/usr/share/icons/hicolor/scalable/hildon/$ICON_NAME.png"`
fi
SH="${JAR%.*}.sh"
if [ -f "${SH}" ]; then
echo -n "${SH} Already exists, overwrite the file? (Y/N) "
read tmpans
answer=$(echo "$tmpans" | tr '[:upper:]' '[:lower:]')
if [ "$answer" != "y" ] && [ "$answer" != "Y" ]; then
echo "Not overwriting ${SH} file!"
else
rm -f "${SH}"
fi
fi
if [ ! -f "${SH}" ]; then
MAINCLASS=`cat $JAD | grep 'MIDlet-1:' | cut -d ',' -f 3`
READLINKJAR=`readlink -f $JAR`
echo '#!/bin/sh' > $SH
echo '' >> $SH
echo '/opt/phoneme/bin/cvm -Xmx12m -Dmicroedition.profiles=MIDP-2.1 -Dsun.midp.library.name=midp -Dsun.midp.home.path=/opt/phoneme/midp/midp_linux_fb_gcc -Dcom.sun.midp.mainClass.name=com.sun.midp.main.CdcMIDletSuiteLoader sun.misc.MIDPLauncher -suitepath' $READLINKJAR '-jadpath' $JAD -1 $MAINCLASS >> $SH
chmod a+x $SH
echo "${SH} file created!"
READLINK=`readlink -f $SH`
MIDLET_NAME=`grep "MIDlet-Name: " $JAD | sed /MIDlet-Name:/s///`
MIDLET_VERSION=`grep "MIDlet-Version: " $JAD | sed /MIDlet-Version:/s///`
echo -e "[Desktop Entry]
Encoding=UTF-8
Version=$MIDLET_VERSION
Type=Application
Name=$MIDLET_NAME
Exec=.$READLINK
X-Osso-Type=application/x-executable
Terminal=true
Icon=$ICON_NAME" | sudo tee /usr/share/applications/hildon/"$MIDLET_NAME".desktop
sleep 6
run-standalone.sh dbus-send --type=method_call --dest=org.freedesktop.Notifications /org/freedesktop/Notifications org.freedesktop.Notifications.SystemNoteInfoprint string:"Created! The $MIDLET_NAME shortcut is now on the Menu"
echo "$MIDLET_NAME added as a .desktop shortcut"
sleep 4 ; else
run-standalone.sh dbus-send --type=method_call --dest=org.freedesktop.Notifications /org/freedesktop/Notifications org.freedesktop.Notifications.SystemNoteInfoprint string:"Unable to create $MIDLET_NAME.desktop file, check the ownership and try again!"
sleep 2
echo "Unable to add $MIDLET_NAME added as a .desktop shortcut, check the ownership!"
fi
exit 0
| The Following User Says Thank You to santiago For This Useful Post: | ||