http://wiki.webos-internals.org/api.php?action=feedcontributions&user=Computrav&feedformat=atomWebOS Internals - User contributions [en]2024-03-28T22:03:12ZUser contributionsMediaWiki 1.35.1http://wiki.webos-internals.org/index.php?title=On_Screen_Keyboard&diff=4791On Screen Keyboard2009-08-25T21:41:39Z<p>Computrav: </p>
<hr />
<div>[[Image: On_Screen_Keyboard.png|thumb|right]]<br />
'''Warning. This is PRE ALPHA testing grade only software. It may cause your pre to melt into a puddle and dissolve while turning blue. Use at your own risk!'''<br />
[[Image: On_screen_keyboard_2.png|thumb|right]]<br />
=Introduction=<br />
The Palm Pre ships with a very limited on-screen keyboard for inserting symbols. It works in portrait and landscape, in all apps, in any text field. (It doesn't work in Search fields like email address or url, which has led to difficulties with enhancing it.) This on screen keyboard has provided a basis for programmers to develop a fully functional on screen keyboard for the Pre. <br />
<br />
=Background and Explanation=<br />
On an unmodified Pre if you press the "sym" key and a scrollable 5x5 keyboard pops up full of alternate characters. <br />
[[Image: On_screen_keyboard_3.png|thumb|right]]<br />
[[Image: Messaging_2009-22-08_000708.png|thumb|right]]<br />
This is controlled by code incorporated into the framework.js. The specific functions there can be seeen in '''/usr/palm/frameworks/mojo/submissions/191.15/javascripts/widget_charselector.js'''<br />
<br />
with the layout controlled by 3 files in '''/usr/palm/frameworks/mojo/submissions/191.15/templates/charselector'''<br />
<br />
the actual list of characters that appear on the screen is controlled by '''/usr/palm/frameworks/mojo/submissions/191.15/resources/en_us/alternatechars_table.json'''<br />
<br />
At the simplest level then, creating an on-screen keyboard requires editing the alternate characters table json, to add the "regular" charcters to it, and then when you want a keyboard, press SYM and poof, a keyboard. The problem with that is, the alternatechars_table.json is "fragile" the slightests mis-edit results in the pre entering a continuous book cycle. <br />
<br />
At the next level, the framework's copy of widget_charselector.js needs to be modified to not close the keyboard after each keypress. <br />
<br />
As of 12 August 2009 Webos-internals contributor Eric Gaudet (irc egaudet) announced success at patching the framework.js to accept a new function derived from the charselector widget. This pre-alpha proof of concept on-screen keyboard is available as a patch. <br />
<br />
=Operation= <br />
Unlike the Palm Symbol keyboard, you do not have to open the Pre's hardware keyboard to get the on-screen keyboard. Double-tapping the gesture area (near the round silver button) will bring up the on-screen keyboard if you are in a text field. '''Note:''' as of 19 August 2009, the on-screen keyboard does NOT YET WORK in search boxes (email, name, etc).<br />
<br />
=Procedure=<br />
The patch is on Gitorious, please read the following to install the patch: [[Applying_Patches|Applying Patches]]<br />
<br />
The patch should be stored (on Pre) in: /opt/src/modifications/frameworks/add-onscreen-keyboard.patch<br />
<br />
Folow these instructions to install the patch AND the theme images (NOTE: must be root)<br />
<br />
<pre><br />
cd /opt/src/modifications/frameworks<br />
git pull<br />
sh install_kb<br />
</pre><br />
<br />
<br />
Double-tap gesture area on Pre while a textfield is highlighted to bring up keyboard.<br />
Double-tap pageup on your keyboard in Emulator while textfield is highlighted to bring up keyboard.<br />
<br />
=Change Log=<br />
===8/13/09 - Fixes===<br />
* Functional backspace, space and enter keys added.<br />
<br />
===8/16/09 - Fixes===<br />
* Added functional shift and sym capabilities.<br />
* Added landscape mode resize.<br />
<br />
<br />
===8/18/09 - Fixes/Enhancements===<br />
* Added theme capabilities<br />
* Changed default theme to use remix2000's images (big thanks!)<br />
* Added missing symbols<br />
* Fixed landscape mode to correctly render in landscape if launched from that state.<br />
<br />
Thanks again to remix2000 for the nice keyboard images. Specs will be posted eventually for the images/theme framework once a user-app callable way to switch themes is implemented.<br />
<br />
===8/18/09 (evening) - Fixes/Enhancements===<br />
* Increased width of keyboard to span entire screen<br />
* Added orange-key functionality<br />
* Made keyboard draggable after tapping blank key<br />
* Added haptic feedback<br />
<br />
===8/21/09 - Fixes/Enhancements===<br />
* Added support for Emulator (pageup will mimic gesture tap, double-tap for keyboard)<br />
* Separated themes from palm framework<br />
* Added customizable options and themes via .json files<br />
* Shrink keys when "active", i.e. shift, orange, sym...<br />
* Changed keyboard to come up with double-tap of gesture area (within 600ms)<br />
* Enabled usage within search fields (messaging/email apps etc...)<br />
* Changed position calculations to render keyboard as low as possible without covering cursor on initialization<br />
<br />
=Issues=<br />
as of 21 August 2009 the following issues are known: <br />
<br />
* The top-most and left-most buttons do not show correctly when pressed (they get cut off)<br />
* Sym key re-draws and re-positions the keyboard, should at least not re-position.<br />
* Auto-Correct is not functional (SmartTextEngine is handled in libWebKitLuna.so, so might need plugin to add this support)<br />
* Clipboard, orange-scroll and shift-highlight do not operate with virtual keyboard<br />
* There is no way to bring up Global Search without pressing a key on the hard keyboard. One idea is to add a top-bar item in between the app menu and device menu that will launch Global Search with the virtual keyboard displayed. The virtual keyboard already works properly once the Global Search is in the foreground (i.e. after a hard keypress)<br />
* Explore T9-type, limited-width keyboard options<br />
* Hide kb when focus changes from text box (e.g. landscape in web browser, text box goes away)<br />
* backspace and enter do not work in textfields within a webview. The browserAdapter plugin controls these text fields and have not exposed any methods other than inserting a valid character at the cursor position. At least none that I have found yet.<br />
<br />
<br />
=User configurable options=<br />
There is a config file located at /media/internal/virtual-keyboard/kb_config.json, with the following options:<br />
* haptic : <number> - How long to vibrate upon touch (0 - 100 ms)<br />
* clickFile : <string> - Sound file to play upon button click (e.g. click1.wav)<br />
* theme : <string> - Name of keyboard theme to use (remix_classic, remix_glossy, remix_ice)<br />
<br />
=Keyboard Themes=<br />
The virtual keyboard layout is a "list" of rows containing 10 "elements" each. The design allows for the keys to span multiple elements.<br />
<br />
The virtual keyboard will look for themes located at /media/internal/virtual-keyboard/themes/<br />
In this directory there shall exist theme-named directories with the following structure and options:<br />
<br />
theme_config.json is the file that will control what images in this directory should be used and how. The following keys are accepted:<br />
<br />
* index : <number> - (required) Key index on keyboard layout {e.g. for default layout, index of q is 0, index of a is 10, index of space is 24}<br />
* character : <string> - Character to display when user hits associated key<br />
* image : <string> - Name of image (located in this theme's directory) to display on keyboard for specified index'd key<br />
* span : <number> - How many elements the key shall take up (e.g. default is 3 for space bar)</div>Computravhttp://wiki.webos-internals.org/index.php?title=Applying_Patches&diff=4790Applying Patches2009-08-25T21:34:29Z<p>Computrav: </p>
<hr />
<div>==Introduction==<br />
<br />
We cannot legally redistribute Palm source code (it is copyrighted code, and is not released under an open source license) therefore we need to manage our modifications as patches. Since these patches will come from many different places, and will need to be removed before each OTA update and then reapplied after-wards, we need a procedure and tools for doing this. This page documents this procedure.<br />
<br />
Before asking questions about this procedure, please read the following documents fully:<br />
<br />
An introduction to Quilt can be found at http://www.suse.de/~agruen/quilt.pdf<br />
<br />
The manual for quilt is at http://linux.die.net/man/1/quilt<br />
<br />
<br />
==Upgrading from quilt to quilt-lite==<br />
<br />
If you have performed these instructions before the 8th Aug 2009, you will have installed a very heavyweight version of the quilt package which has a dependency on a very large perl package.<br />
<br />
This dependency has been removed in a new quilt-lite package, which saves 26MB of space in /var as a result.<br />
<br />
You can switch over to it as follows:<br />
<br />
* ipkg-opt update<br />
* ipkg-opt remove quilt perl libdb gdbm util-linux-ng e2fslibs ncursesw ncurses<br />
* ipkg-opt install quilt-lite<br />
<br />
Alternatively, the setup script below will prompt to uninstall quilt, perl, etc ..., and install quilt-lite, if quilt is installed.<br />
<br />
<br />
==Setup Procedure (Scripted)==<br />
The process of setting up quilt has been scripted. The script performs the following actions:<br />
* Installs (or upgrades) git and any dependencies<br />
* Installs (or upgrades) quilt (actually quilt-lite, a version of quilt that does not depend on perl) and any dependencies<br />
* Configures quilt to store patches in /opt/src/patches<br />
* Creates (or updates) a local clone of the webos-internals modifications repository<br />
<br />
Each step is only performed if necessary. Please note that ipkg-opt needs to be installed. The instructions are found [[Next_steps|here]].<br />
<br />
To get run the script, log into your Pre, gain root privileges and run the following commands:<br />
<pre><nowiki><br />
cd /tmp<br />
wget http://gitorious.org/webos-internals/bootstrap/blobs/raw/master/quilt-bootstrap.sh<br />
sh quilt-bootstrap.sh<br />
</nowiki></pre><br />
<br />
<br />
==Setup Procedure (Manual Process)==<br />
(Note: Even though you may have previously installed the optware quilt patch manager, it won't damage anything to follow the Setup procedure. Alternatively, if you KNOW FOR SURE these are installed and your packages are up-to-date, you can skip to Importing and Applying Patches).<br />
<br />
* Log into your Pre, and gain root privileges. (Note: This command is not required when using the emulator)<br />
<pre><nowiki><br />
sudo -i # Yes, the -i is important. <br />
</nowiki></pre><br />
<br />
* Put your Pre in to Read Write Mode<br />
<pre><nowiki><br />
mount -o remount,rw /<br />
</nowiki></pre><br />
<br />
* Ensure that you are set up for optware package installations, and make sure you have the latest package index:<br />
<pre><nowiki><br />
ipkg-opt update<br />
</nowiki></pre><br />
<br />
* Install the 'quilt-lite' package, which will be used to manage the patches you apply, and the 'git' package, which will be used to download existing patches from the modifications repository:<br />
<pre><nowiki><br />
ipkg-opt install quilt-lite git<br />
</nowiki></pre><br />
<br />
(If you already have those packages installed, repeating this step will not cause any harm.)<br />
<br />
* Create a directory in which 'quilt' will manage your chosen modifications:<br />
<pre><nowiki><br />
mkdir -p /opt/src/patches<br />
</nowiki></pre><br />
<br />
* Edit /opt/etc/quilt.quiltrc to point quilt to that directory:<br />
<pre><nowiki><br />
sed -ire 's|^[\s#]*QUILT_PATCHES=.*|QUILT_PATCHES=/opt/src/patches|' /opt/etc/quilt.quiltrc<br />
</nowiki></pre><br />
<br />
* Delete any existing webos-internals modifications directories<br />
<pre><nowiki><br />
rm -rf /opt/src/modifications<br />
</nowiki></pre><br />
<br />
* Clone the webos-internals modifications repository:<br />
<pre><nowiki><br />
cd /opt/src<br />
git clone git://gitorious.org/webos-internals/modifications.git<br />
</nowiki></pre><br />
<br />
<br />
==Importing and Applying Patches==<br />
<br />
* Ensure your list of modifications is up to date<br />
<pre><nowiki><br />
cd /opt/src/modifications<br />
git pull<br />
</nowiki></pre><br />
** If you find yourself getting errors when you try to pull with the above command then you will need to modify your .git/config file<br />
<pre><nowiki><br />
sudo vi /opt/src/modifications/.git/config<br />
</nowiki></pre><br />
<br />
** Your [master] section should look like the following<br />
<pre><nowiki><br />
[branch "master"]<br />
remote = origin<br />
merge = refs/heads/master <br />
</nowiki></pre><br />
<br />
* Browse the set of available patches. Each patch should have a description at the top.<br />
<pre><nowiki><br />
find /opt/src/modifications -name *.patch<br />
</nowiki></pre><br />
<br />
* Choose a patch from the modifications repository and import it into your own patches directory:<br />
<pre><nowiki><br />
cd / # It is *very* important to be in the / directory when you run quilt.<br />
quilt import /opt/src/modifications/application_name/patch_name.patch # Note that you need to replace application_name and patch_name here.<br />
</nowiki></pre><br />
<br />
* Verify that quilt has imported the patch successfully:<br />
<pre><nowiki><br />
# You should still be in the / directory to run quilt.<br />
quilt series # you should see your patch listed in here<br />
</nowiki></pre><br />
<br />
* Instruct quilt to apply your patch<br />
<pre><nowiki><br />
# You should still be in the / directory to run quilt.<br />
quilt push<br />
# Use this to push all patches at once.<br />
quilt push -a<br />
</nowiki></pre><br />
<br />
* If everything worked correctly, the patch should now be applied. You will usually need to restart the luna service on the Pre to see the effect of patches to applications. Here's how to initiate a rescan.<br />
<pre><nowiki><br />
luna-send -n 1 palm://com.palm.applicationManager/rescan {}<br />
</nowiki></pre><br />
<br />
If that doesn't work, try a service restart with:<br />
<pre><nowiki><br />
stop LunaSysMgr && start LunaSysMgr<br />
</nowiki></pre><br />
<br />
And if all else fails, simply reboot:<br />
<pre><nowiki><br />
reboot<br />
</nowiki></pre><br />
<br />
<br />
==Listing Applied Patches==<br />
<pre><nowiki><br />
cd / # It is *very* important to be in the / directory when you run quilt.<br />
quilt applied<br />
</nowiki></pre><br />
<br />
<br />
==Removing All Patches==<br />
<br />
Before you accept an over-the-air (OTA) update, you should remove any patches you have applied. Luckily, using quilt makes this very easy.<br />
<br />
* Remove all patches:<br />
<pre><nowiki><br />
cd / # It is *very* important to be in the / directory when you run quilt.<br />
quilt pop -a<br />
</nowiki></pre><br />
<br />
<br />
==Reapplying all patches==<br />
<br />
After your OTA update is complete, you will want to reapply any patches you have selected. This may or may not go smoothly.<br />
<br />
* Apply all patches:<br />
<pre><nowiki><br />
cd / # It is *very* important to be in the / directory when you run quilt.<br />
quilt push -a<br />
</nowiki></pre><br />
<br />
* Put your Pre back in to Read Only mode<br />
<pre><nowiki><br />
mount -o remount,ro /<br />
</nowiki></pre><br />
<br />
<br />
==Information for developing patches==<br />
<br />
===Getting Authenticated with gitorious.org===<br />
Before you can commit to gitorious you need to [http://gitorious.org/users/new create an account]. <br />
<br />
Next you'll need to generate a public key and share that with gitorious.org, your public key is how gitorious.org authenticates you and checks if have the permissions required to do a commit to a given repository.<br />
<br />
Getting your key on window<br />
* Download [http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html PuTTYgen] and [http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html Pageant]<br />
<br />
--Gitorious.org [http://gitorious.org/about/faq gitorious.org recommends] you use [http://code.google.com/p/msysgit/ msysGit].--<br />
<br />
* On Windows use [http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html PuTTYgen] to generate a public/private key pair. <br />
<br />
<pre><nowiki><br />
Key -> SSH-2 RSA KEY<br />
Key -> Generate key pair<br />
</nowiki></pre><br />
After some wiggling of the mouse your keys will be generated. You should fill in the //Key passphrase// and it's confirmation to secure you key. Save off the public and private key pairs to your user folder.<br />
<br />
* After which you will need to run [http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html Pageant] on your pc. Pageant holds your private key in memory for PuTTY to use.<br />
<br />
* To commit changes to gitorious.org from the pre you will need to install openssh on the device.<br />
<pre><nowiki><br />
ipkg-opt update<br />
ipkg-opt install openssh # since dropbear doesn't do agent forwarding, you need to use openssh<br />
</nowiki></pre><br />
<br />
Actually, it is possible to use dropbear with git but requires [http://tumblelog.jauderho.com/post/151678345/using-dropbear-with-git some hackery].<br />
<br />
As an alternative, if you don't use the keys for anything else you could just generate them on the pre after installing open-ssh<br />
<pre><nowiki><br />
sudo ssh-keygen -t rsa # follow the prompts<br />
cat ~/.ssh/id_rsa.pub # display the public key you need to paste into gitorious<br />
</nowiki></pre><br />
<br />
* Don't forget to upload your public key to gitorious.org after generating it.<br />
Now you should be able to follow the steps below and contribute your code to gitorious.org.<br />
<br />
* If you find yourself getting errors about your public key when you try to push changes, check to make sure your keys are under /var/home/root/.ssh/ and not under your regular user account.<br />
<br />
===Creating a patch===<br />
<br />
* Before making any changes to files:<br />
<br />
<pre><nowiki><br />
cd / # It is *very* important to be in the / directory when you run quilt.<br />
quilt new patch_name.patch<br />
quilt add /usr/palm/applications/com.palm.app.appYouWantToMod/app/controllers/mod-assistant.js<br />
quilt add /usr/palm/applications/com.palm.app.appYouWantToMod/app/controllers/mod2-assistant.js<br />
</nowiki></pre><br />
<br />
* Now you can make changes on the Pre using vi/nano/joe/whatever, or sftp files to your machine and make changes. Make sure any file you change has been added in the above step.<br />
<br />
<pre><nowiki><br />
quilt files # view files that are being tracked<br />
quilt header -e # add a header to the patch to describe it (please do this!)<br />
</nowiki></pre><br />
<br />
* Once you are finished and ready to create a patch<br />
<br />
<pre><nowiki><br />
quilt refresh # this will create/update the /opt/src/patches/patch_name.patch file<br />
</nowiki></pre><br />
<br />
===Pushing the change back to gitorious.org===<br />
<br />
* copy the patch into the modification tree you cloned above<br />
<br />
<pre><nowiki><br />
mkdir /opt/src/modifications/application_name # You need to change application_name to the leaf of the palm application id.<br />
cp /opt/src/patches/patch_name.patch /opt/src/modifications/application_name/patch_name.patch<br />
</nowiki></pre><br />
<br />
* Identify yourself in git (use the user you have setup at gitorious.org)<br />
<br />
<pre><nowiki><br />
cd /opt/src/modifications<br />
git config --global user.name "user"<br />
git config --global user.email "youremail@example.com"<br />
</nowiki></pre><br />
<br />
* Commit your changes to your local git<br />
<br />
<pre><nowiki><br />
git add application_name/patch_name.patch<br />
git commit<br />
</nowiki></pre><br />
<br />
* Since we did a clone the first time, we need to recreate the origin:<br />
<br />
<pre><nowiki><br />
git remote rm origin # (if you did a clone, we have to replace the origin)<br />
git remote add origin git@gitorious.org:webos-internals/modifications.git<br />
</nowiki></pre><br />
<br />
* Finally, push your changes up to gitorious.org<br />
<br />
<pre><nowiki><br />
git push origin master # first time<br />
git push # any future pushes<br />
</nowiki></pre><br />
<br />
* If the push does not work, try to debug the ssh connection<br />
<pre><nowiki><br />
/opt/bin/ssh -v git@gitorious.org<br />
</nowiki></pre><br />
<br />
==Extended, annotated sample session with quilt==<br />
* First, we just need to setup a file to muck with<br />
<pre><nowiki><br />
root@castle:/# cd /<br />
root@castle:/# echo "Original file" > /usr/test<br />
root@castle:/# echo "2nd lien" >> /usr/test<br />
root@castle:/# echo "3rd ilne" >> /usr/test<br />
root@castle:/# echo "last line" >> /usr/test<br />
</nowiki></pre><br />
* Start a new patch (normally you'll want to use patch_name.patch, I just wanted a shortened name)<br />
<pre><nowiki><br />
root@castle:/# quilt new p1<br />
Patch /opt/src/patches/p1 is now on top<br />
</nowiki></pre><br />
* You must quilt add any files that you are going to edit or create '''before''' you edit or create them.<br />
<pre><nowiki><br />
root@castle:/# quilt add /usr/test<br />
File /usr/test added to patch /opt/src/patches/p1<br />
</nowiki></pre><br />
* Just using sed to correct the spelling on the 2nd line<br />
<pre><nowiki><br />
root@castle:/# sed -i -e 's/lien/line/' /usr/test<br />
</nowiki></pre><br />
* quilt refresh actually finds what you have changed and writes it to the patch file (at this point, you can use git to push your changes)<br />
<pre><nowiki><br />
root@castle:/# quilt refresh<br />
Refreshed patch /opt/src/patches/p1<br />
</nowiki></pre><br />
* Just for fun, let's do it again<br />
<pre><nowiki><br />
root@castle:/# quilt new p2<br />
Patch /opt/src/patches/p2 is now on top<br />
</nowiki></pre><br />
* Again, add file, make some changes, refresh to update the patch.<br />
<pre><nowiki><br />
root@castle:/# quilt add /usr/test<br />
File /usr/test added to patch /opt/src/patches/p2<br />
root@castle:/# sed -i -e 's/ilne/line/' /usr/test<br />
root@castle:/# quilt refresh<br />
Refreshed patch /opt/src/patches/p2<br />
</nowiki></pre><br />
* Just an example of rolling back changes<br />
<pre><nowiki><br />
root@castle:/# quilt pop<br />
Removing patch /opt/src/patches/p2<br />
Restoring usr/test<br />
<br />
Now at patch /opt/src/patches/p1<br />
root@castle:/# quilt pop<br />
Removing patch /opt/src/patches/p1<br />
Restoring usr/test<br />
<br />
Now at patch /opt/src/patches/enable-browser-downloads.patch<br />
root@castle:/# cat /usr/test<br />
Original file<br />
2nd lien<br />
3rd ilne<br />
last line<br />
</nowiki></pre><br />
* delete will delete the patch from your series, but leave the actual patch file in /opt/src/patches (so you could import it later)<br />
<pre><nowiki><br />
root@castle:/# quilt delete p1<br />
Removed patch /opt/src/patches/p1<br />
</nowiki></pre><br />
* Since we removed p1, push will now apply p2. However, since p2 was applied against p1 originally, p2 will report an error. If the changes are too significant, you can force with -f, but you should carefully inspect the resulting files.<br />
<pre><nowiki><br />
root@castle:/# quilt push<br />
Applying patch /opt/src/patches/p2<br />
patching file usr/test<br />
Hunk #1 succeeded at 1 with fuzz 2.<br />
<br />
Now at patch /opt/src/patches/p2<br />
</nowiki></pre><br />
* If we want, we can refresh the patch so that future users of the patch do not receive the "fuzz" warning.<br />
<pre><nowiki><br />
root@castle:/# quilt refresh<br />
Refreshed patch /opt/src/patches/p2<br />
root@castle:/# cat /usr/test<br />
Original file<br />
2nd lien<br />
3rd line<br />
last line<br />
</nowiki></pre><br />
* cleanup<br />
<pre><nowiki><br />
root@castle:/# rm /usr/test<br />
</nowiki></pre><br />
<br />
==Background info==<br />
<br />
* [http://pkg-perl.alioth.debian.org/howto/quilt.html quilt]<br />
<br />
==Script for Updating/Installing Patches==<br />
<br />
I just wanted to share the following script that I just finished testing out. It's only been tested on my Pre so far, as I don't have access to any others.. It just updates the patch list, prints out available patches, then lets you choose which to apply.<br />
<br />
<pre><nowiki><br />
#!/opt/bin/bash<br />
<br />
cd /opt/src/modifications<br />
tput clear<br />
echo Updating list...<br />
git pull<br />
tput clear<br />
cd /<br />
<br />
a=0<br />
for inputline in $(find /opt/src/modifications -name *.patch | sort)<br />
do<br />
a=$(($a+1));<br />
line="$(echo $inputline)"<br />
MYARRAY[$a]="$line"<br />
echo "${a}${line}" | awk -F "/" 'sub(".patch","",$6) {printf "%-3s %-15s %s\n", $1, $5, $6}'<br />
done<br />
echo "q quit"<br />
<br />
x=$(($a+1));<br />
until [ -n "$opt" ] ; do<br />
read -p "Enter the line number for patch to apply [1 - $a] " opt<br />
if [ "$opt" = "q" ] ; then<br />
exit 0<br />
fi<br />
if [ "$opt" -lt "$x" 2> /dev/null ] && [ "$opt" -gt 0 2> /dev/null ] ; then<br />
true<br />
else<br />
opt=""<br />
fi<br />
done<br />
<br />
tput clear<br />
cd /<br />
quilt import ${MYARRAY[$opt]}<br />
quilt push<br />
luna-send -n 1 palm://com.palm.applicationManager/rescan {}<br />
<br />
</nowiki></pre></div>Computravhttp://wiki.webos-internals.org/index.php?title=Next_steps&diff=4789Next steps2009-08-25T21:10:38Z<p>Computrav: </p>
<hr />
<div>''The old, manual setup of Optware and users can be found [[Setting_up_optware_feed | here]].''<br />
<br />
=Automated Setup of Optware, Users and Access=<br />
The webOS community asks that users who have obtained access to the Linux subsystem install a standard set of software to ensure everyone has the necessary tools in place to use the resources the community is providing.<br />
<br />
In particular, this includes the Optware package manager. Palm's webOS uses the ''ipkg'' package manager internally. The community has a version of ''ipkg'' called ''ipkg-opt'' which accesses the Optware library of over 1300 Linux programs available for installation on the Pre. <br />
<br />
Palm has indicated that they have no intention of using the /opt directory, so we direct our installs to /opt/bin rather than /bin to avoid being overwritten by future Palm software upgrades. <br />
<br />
In addition, the standard package creates a non-root user, installs ''sudo'', and includes a SSH program (''Dropbear'') and SFTP program. <br />
<br />
For your convenience, we've packaged all this up into a simple script.<br />
<br />
==Optware Setup==<br />
<br />
===Installing Optware in the Emulator?===<br />
If you're attempting to install these packages to your emulator, you must first add sufficient space by [[Adding_Disks_to_the_Emulator|enabling a virtual disk]].<br />
<br />
<br />
After completing the process of obtaining access to your Pre, do the following: <br />
<br />
'''Type each line exactly as it appears. Copying and pasting is probably a good idea.''' <br />
<br />
''Note to Windows Putty users: To paste in putty, simply right-click and the program pastes into the terminal whatever you have copied to the clipboard.''<br />
<br />
<div style="font-size:100%;"><br />
<source lang=bash><br />
cd /tmp<br />
wget http://gitorious.org/webos-internals/bootstrap/blobs/raw/master/optware-bootstrap.sh<br />
sh optware-bootstrap.sh<br />
source /etc/profile.d/optware<br />
</source></div><br />
<br />
Follow the on-screen instructions. <br />
<br />
If you want to review the script before you run it, you can look here: <br />
<br />
[http://gitorious.org/webos-internals/bootstrap/blobs/master/optware-bootstrap.sh http://gitorious.org/webos-internals/bootstrap/blobs/master/optware-bootstrap.sh]<br />
<br />
==Quilt setup==<br />
<br />
Optionally, you can then install the ''quilt'' patch manager which allows multiple-file patches. (Yes, the pun was intentional. Quilt manages multiple patches.) This installation process has also been packaged into a simple script. It will install quilt, and all of its dependencies, and create a local clone of the WebOS-Internals patch repository. [[Applying_Patches | Applying Patches]] provides a more thorough guide on the use of quilt.<br />
<br />
'''Again, type each line exactly as it appears. Copying and pasting is probably a good idea.'''<br />
<br />
<div style="font-size:100%;"><br />
<source lang=bash><br />
cd /tmp<br />
wget http://gitorious.org/webos-internals/bootstrap/blobs/raw/master/quilt-bootstrap.sh<br />
sh quilt-bootstrap.sh<br />
</source></div><br />
<br />
If you want to review the script before you run it, you can look here: <br />
<br />
[http://gitorious.org/webos-internals/bootstrap/blobs/master/quilt-bootstrap.sh http://gitorious.org/webos-internals/bootstrap/blobs/master/quilt-bootstrap.sh]<br />
<br />
==Finishing==<br />
<br />
To finish off, turn Developer Mode back to "Off" (which will reboot your Pre).<br />
<br />
Once you are finished, you may SSH into your Pre with an SSH client like [http://www.chiark.greenend.org.uk/~sgtatham/putty/ Putty]:<br />
*Find your IP address with [http://checkmyip.com/ CheckMyIP.com]<br />
*SSH to that IP address on port 222<br />
**If you're doing this over EVDO, there may be a lot of latency. Be patient.<br />
**You can optionally install [[Avahi]] and SSH to <tt>castle.local.</tt><br />
*Log in with the username and password you created during the Optware installation<br />
**Many operations cannot be carried out with the permissions of that username. You'll need to [[Basic_Linux_Use#sudo|sudo]] those operations with the new username's password<br />
<br />
Only the default shell (/bin/ash) will work for ssh. To change your shell to bash (located in /opt/bin/bash after the install), you will have to create an /etc/shells file, and add the following lines:<br />
<br />
/bin/ash<br />
/bin/sh<br />
/opt/bin/bash<br />
<br />
Then you will be able to edit /etc/passwd and change the shell parameter for the user you created. Note that if you try to change your shell without adding an /etc/shells the SSH server (Dropbear) will look like it is rejecting your password on subsequent connections.</div>Computravhttp://wiki.webos-internals.org/index.php?title=Adding_Disks_to_the_Emulator&diff=4788Adding Disks to the Emulator2009-08-25T21:02:38Z<p>Computrav: /* Enabling Virtual Disk Support for the Emulator In Order to Setup Optware */</p>
<hr />
<div>=Enabling Virtual Disk Support for the Emulator In Order to Setup Optware=<br />
Many developers wish to maintain their emulator with the same software as their actual device. In order to install the Optware package manager on your emulator, you will need to allocate a virtual disk for additional storage.<br />
<br />
# Run VirtualBox (the underlying virtualisation software which runs the Pre Emulator). Ensure that the emulator to which you wish to add storage is in the "Powered Off" state.<br />
# Goto "File" -> "Virtual Media Manager" (or Ctrl+D).<br />
# Click or select "New" and press "Next."<br />
# Choose whether you want a fixed- or dynamic-sized virtual disk then hit "Next."<br />
# Click the small folder icon next to the virtual disk's name to choose where the virtual drive will exist. This is important if one of your physical disks is low on space but you have ample space on another.<br />
# Choose the size of the virtual disk using the slider keeping in mind an out-of-the-box Pre itself has < 8gb free and give due consideration as to how much space your intentions may require.<br />
# When you click "Finish" the creation may take some time depending on the size of the virtual disk you created.<br />
# When everything is complete just click "OK."<br />
# Back in VirtualBox, select the emulator to which you wish to add the virtual drive and either click the "Settings" icon, hit Ctrl+S, or click through to "Machine" -> "Settings."<br />
# In the navigation panel on the left, choose "Hard Disks."<br />
# Press "Insert" or click the icon with the green plus sign to ''add an attachment''.<br />
# Make sure under "Slot" the selection reads "Primary Slave" and under "Hard Disk" you point to the virtual disk you created in the steps above.<br />
# Hit "OK," startup your emulator, and [[Next_steps|setup Optware]]!</div>Computrav