Difference between revisions of "Solution to App Catalog Installation Limit"

From WebOS Internals
Jump to: navigation, search
(Commands)
(Source)
Line 197: Line 197:
  
 
== Source ==
 
== Source ==
code:
 
<pre>
 
#!/bin/sh
 
  
# This code is open for re-use with no restrictions.  xorg
+
The source has been moved to gitorious...
# This is a working proof of concept script still in development.
 
# Intent is for someone to port to or use this for a webOS app.
 
 
 
 
 
#-------------------------------------------------------------------------#
 
# versions:
 
# 0.1.0 - original (xorg)
 
# 0.1.1 - added unlink and clean functions (daventx)
 
# 0.1.2 - added bulkmv function, allows moving many apps (xorg)
 
# 0.1.3 - added option for tar backups (xorg)
 
# 0.1.4 - added listmoved function to show apps already moved (xorg)
 
# 0.1.5 - added restoreall function, couple cleanup items (xorg)
 
# 0.1.6 - fixed to show usage if no appname supplied to link/unlink (xorg)
 
# 0.1.7 - added cleanexit (w/mount ro /)
 
#      - added exit code documentation for javascripts calling this (xorg)
 
# 0.2.0 - will not move apps that would have attribute issues (xorg)
 
#      - will not move apps that have no json file
 
#      - improved error handling, improved listing shows actual app names
 
# 0.2.1 - minor update, proper cleanup if link command doesn't move app
 
#      - don't create tar backup until testing if app is movable (xorg)
 
# 0.2.2 - broke with Fair Dinkum - resolved by explicit path for du (nt4cats)
 
#      - will not move an app if it is running, thx to greg roll
 
#      - faster listmoved apps (but no size), error reporting cleanup (xorg)
 
# 0.2.3 - new trap method for link cp errors ; version reporting in usage
 
#      - doesn't allow to use mvapp if USB drive is mounted to computer (xorg)
 
# 0.2.4 - turned off TAR backups by default, added 'mvapp info'
 
#      - added two hidden functions (see mvapp homepage for details)
 
#      - 'mvapp ftr' - force tar restore, 'mvapp rtb' - remove tar backups
 
#-------------------------------------------------------------------------#
 
 
 
#-------------------------------------------------------------------------#
 
# variables: these are globally available to all functions
 
#-------------------------------------------------------------------------#
 
COMMAND=$1
 
APP=$2
 
VERSION=0.2.4
 
MEDIA=/media/internal/.apps
 
VAR=/var/usr/palm/applications  # Do not change this
 
 
 
# TAR backups are no longer needed, recommend setting to 0
 
BACKUP=0  # set to 1 for tar backups, 0 to disable
 
BACKUPDIR=/media/internal/.appbackups
 
 
 
# This should be turned on.  Only turn off if javascript is calling this script.
 
PROMPTS=1
 
 
 
#-------------------------------------------------------------------------#
 
# exit codes for javascripts:
 
# function usage:
 
# 1 - normal usage error
 
# 100 - USB drive is mounted, cannot use mvapp
 
#
 
# function cleanapp:
 
# 0 - normal exit
 
# 30 - link for app does not exist
 
#
 
# function linkapp:
 
# 0  - normal exit
 
# 10 - app name not supplied
 
# 11 - link already exists
 
# 12 - app does not exist in VAR
 
# 13 - copy failed from VAR to MEDIA
 
# 14 - removing app from VAR failed
 
# 15 - APP has attributes not supported on FAT, did not move to MEDIA
 
# 16 - APP has no json file, did not move to MEDIA
 
# 17 - APP is running, need to close the app before moving
 
#
 
# function unlinkapp:
 
# 0  - normal exit
 
# 20 - app name not supplied
 
# 21 - app doesn't exist on MEDIA
 
# 22 - tar restore failed
 
# 23 - copy from MEDIA to VAR failed (only used if tar backup doesn't exist)
 
# 24 - remove from MEDIA failed
 
#
 
#-------------------------------------------------------------------------#
 
 
 
#-------------------------------------------------------------------------#
 
# function: cleanexit - exit with cleanup items
 
#-------------------------------------------------------------------------#
 
 
 
cleanexit () {
 
code=$1
 
 
 
# put / back to read only
 
  mount -o remount,ro /
 
 
 
# Uncomment if you want verbose exit codes
 
# echo "exit code: $code"
 
 
 
exit $code
 
}
 
# end of cleanexit function
 
 
 
 
 
#-------------------------------------------------------------------------#
 
# function: usage - show command usage options
 
#-------------------------------------------------------------------------#
 
usage () {
 
  exitcode=$1
 
  if [ ! $exitcode ]
 
  then
 
    exitcode=1  # default exit code for usage, otherwise exit with incode
 
  fi
 
 
 
  echo "mvapp version: $VERSION"
 
  echo "Usage: mvapp info                  - view mvapp homepage in phone browser"
 
  echo "Usage: mvapp link domain.appname    - move app to media, create link"
 
  echo "Usage: mvapp unlink domain.appname  - restore app to var, remove link"
 
  echo "Usage: mvapp clean domain.appname  - remove app dir and links"
 
  echo "Usage: mvapp list                  - list all apps sorted by size"
 
  echo "Usage: mvapp bulkmv                - move/link many apps"
 
  echo "Usage: mvapp listmoved              - list apps that have been moved"
 
  echo "Usage: mvapp restoreall            - restore all apps to original"
 
 
 
  cleanexit $exitcode
 
}
 
# end of usage function
 
 
 
#-------------------------------------------------------------------------#
 
# function: info - launch the mvapp page on webosinternals
 
#-------------------------------------------------------------------------#
 
 
 
info () {
 
HOMEPAGE=http://www.webos-internals.org/wiki/Solution_to_App_Catalog_Installation_Limit
 
 
 
luna-send -n 1 palm://com.palm.applicationManager/launch {\"id\":\"com.palm.app.browser\",\"params\":{\"scene\":\"page\",\"target\":\"$HOMEPAGE\"}}  2>&1 >/dev/null
 
 
 
echo "View on the phone web browser..."
 
 
 
}
 
# end of info function
 
 
 
 
 
#-------------------------------------------------------------------------#
 
# function: cleanapp - removes symbolic links and folder in media and var
 
#-------------------------------------------------------------------------#
 
 
 
cleanapp () {
 
 
 
mount -o remount,rw /
 
 
 
# exit to usage if no app name supplied
 
if [ ! $APP ]
 
then
 
  usage 1
 
fi
 
 
 
if [ -h $VAR/$APP ]
 
then
 
  echo "Continue to remove all traces of $APP."
 
else
 
  echo "$APP link does not exist..."
 
  echo "First attempt to remove the app from Launcher or Homebrew installer."
 
  cleanexit 30
 
fi
 
 
ls -ld $VAR/$APP
 
           
 
# Continue on if PROMPTS turned off (call from outside app)
 
if [ $PROMPTS -eq 1 ] 
 
then
 
  echo "This will remove $APP from both...."
 
  echo "$VAR and "
 
  echo "$MEDIA"
 
  echo
 
  echo "FIRST ATTEMPT TO... remove the app from Launcher or Homebrew installer."
 
  echo
 
  echo "Are you sure you want to remove $APP? [y/N]: "
 
  read answer
 
  case $answer in
 
  [Yy]*) continue;;
 
      *) cleanexit 0;;
 
  esac
 
fi
 
 
 
 
 
 
 
 
echo "Size of $VAR before cleanup... "
 
/usr/bin/du -sh $VAR
 
 
 
if [ -d $MEDIA/$APP ]
 
then
 
    rm -r $MEDIA/$APP
 
      echo "Removed directory" $MEDIA/$APP
 
fi
 
if [ -d $VAR/$APP ]
 
then
 
      rm -r $VAR/$APP
 
      echo "Removed directory" $VAR/$APP
 
fi
 
if [ -h $VAR/$APP ]
 
then
 
      rm -r $VAR/$APP
 
      echo "Removed link" $VAR/$APP
 
fi
 
if [ -f $BACKUPDIR/$APP.tgz ]
 
then
 
      rm -r $BACKUPDIR/$APP.tgz
 
      echo "Removed tar backup" $BACKUPDIR/$APP.tgz
 
fi
 
 
 
 
 
# rescan luna in case it's needed
 
luna-send -n 1 palm://com.palm.applicationManager/rescan {} >/dev/null 2>&1
 
echo "$APP directories and links removed."
 
echo "Size of $VAR after cleanup... "
 
/usr/bin/du -sh $VAR
 
cleanexit 0
 
}
 
# end of cleanup function
 
 
 
 
 
#-------------------------------------------------------------------------#
 
# function: listapps - list the size of each app, sort showing largest last
 
#-------------------------------------------------------------------------#
 
listapps () {
 
echo "First number is size in KB.  Size of 0 is an app already linked."
 
cd $VAR
 
for i in `/usr/bin/du -s * | sort -n |cut -f 2`
 
do
 
    APP=$i
 
    SIZE=`/usr/bin/du -s $VAR/$APP |cut -f1`
 
    TITLE=""
 
    if [ -f $VAR/$APP/appinfo.json ]
 
    then
 
      TITLE=`grep title $VAR/$APP/appinfo.json |cut -d: -f2 |cut -d\" -f2`
 
    fi
 
    echo "$SIZE - $APP - $TITLE"
 
done
 
 
cleanexit 0
 
}
 
# end of listapps function
 
 
 
#-------------------------------------------------------------------------#
 
# function: listmoved - list apps moved/linked, sort showing largest last
 
#-------------------------------------------------------------------------#
 
listmoved () {
 
#/usr/bin/du -sk $MEDIA/* | sort -n  #doesn't show proper size on FAT fs, removing
 
cd $MEDIA
 
#for i in `/usr/bin/du -s * | sort -n |cut -f 2`
 
for i in `ls $MEDIA`
 
do
 
    APP=$i
 
    # Not sure why du reports incorrectly on FAT fs
 
    #SIZE=`/usr/bin/du -s $MEDIA/$APP |cut -f1`
 
    SIZE=""
 
    TITLE=""
 
    if [ -f $MEDIA/$APP/appinfo.json ]
 
    then
 
      TITLE=`grep title $MEDIA/$APP/appinfo.json |cut -d: -f2 |cut -d\" -f2`
 
    fi
 
    echo "$SIZE - $APP - $TITLE"
 
done
 
cleanexit 0
 
}
 
# end of listmoved function
 
 
 
 
 
#-------------------------------------------------------------------------#
 
# function: linkapp - move the app to media and create symbolic link
 
#-------------------------------------------------------------------------#
 
linkapp () {
 
 
 
if [ ! $APP ]
 
then
 
      echo "No application supplied..."
 
      usage 10
 
fi
 
 
# Check if the app is running
 
luna-send -n 1 palm://com.palm.applicationManager/running {} 2>&1 | grep $APP >/dev/null 2>&1
 
if [ $? == 0 ]
 
then
 
  echo "$APP is running.  Close the app before moving."
 
 
 
  code=17
 
  return $code
 
 
 
fi 
 
 
 
if [ ! -f $VAR/$APP/appinfo.json ]
 
then
 
    echo "$APP has no json file.  Will not be moved."
 
    code=16
 
    return 16
 
fi 
 
 
 
if [ ! -d $MEDIA ]
 
then
 
      mkdir $MEDIA
 
fi
 
 
 
if [ -h $VAR/$APP ]
 
then
 
      echo "Link already exists for... ${APP}"
 
      cleanexit 11
 
fi
 
 
 
TITLE=`grep title $VAR/$APP/appinfo.json |cut -d: -f2 |cut -d\" -f2`
 
 
mount -o remount,rw /
 
 
 
if [ -d $VAR/$APP ]
 
then
 
  echo "Moving $APP $TITLE to $MEDIA..."
 
else
 
  echo "$APP does not exist..."
 
  usage 12
 
fi
 
 
 
 
mount -o remount,rw /
 
 
 
echo "Size of $VAR before move... "
 
/usr/bin/du -sh $VAR
 
 
 
# move over to USB drive
 
cp -rp  $VAR/$APP $MEDIA >/tmp/cpresult.out 2>&1
 
if [ -s /tmp/cpresult.out ]
 
then
 
  grep "cannot preserve" /tmp/cpresult.out >/dev/null 2>&1
 
  if [ $? = 0 ]
 
  then
 
  echo
 
  echo "$APP cannot be moved as it contains special attributes."
 
  echo "Leaving app in $VAR."
 
  code=15
 
  rm -r $MEDIA/$APP
 
  rm /tmp/cpresult.out
 
  return $code
 
  else
 
  echo "Copy failed. Leaving app in $VAR."
 
  code=13
 
  fi
 
  rm -r $MEDIA/$APP
 
  rm /tmp/cpresult.out
 
  return $code
 
fi
 
                 
 
 
 
# Backup using tar if enabled
 
if [ $BACKUP -eq 1 ]
 
then
 
  if [ ! -d $BACKUPDIR ]
 
  then
 
    mkdir $BACKUPDIR
 
  fi
 
  echo "Backing up $APP $TITLE to $BACKUPDIR using tar..."
 
  tar czf $BACKUPDIR/${APP}.tgz $VAR/$APP 2>&1 >/dev/null
 
fi
 
 
 
rm -r $VAR/$APP
 
if [ $? != 0 ]
 
then
 
  echo "Remove failed. Leaving app in $VAR."
 
  rm -r $MEDIA/$APP
 
  cleanexit 14
 
fi
 
 
 
# create the symbolic link
 
ln -s $MEDIA/$APP $VAR/$APP
 
 
 
# rescan luna in case it's needed
 
luna-send -n 1 palm://com.palm.applicationManager/rescan {} >/dev/null 2>&1
 
 
 
echo "$APP SUCCESSFULLY moved and linked."
 
echo "Size of $VAR after move... "
 
/usr/bin/du -sh $VAR
 
}
 
# end of linkapp function
 
 
 
 
 
#-------------------------------------------------------------------------#
 
# function: unlinkapp -  restore the app to var and remove symbolic link
 
#-------------------------------------------------------------------------#
 
unlinkapp () {
 
 
 
if [ ! $APP ]
 
then
 
  echo "No application supplied..."
 
  usage 20
 
fi
 
 
 
mount -o remount,rw /
 
 
 
if [ -d $MEDIA/$APP ]
 
then
 
  echo "Restoring $APP..."
 
else
 
  echo "$APP does not exist..."
 
  usage 21
 
fi
 
 
 
echo "Size of $VAR before move... "
 
/usr/bin/du -sh $VAR
 
 
 
# remove the old symbolic link
 
rm -r $VAR/$APP
 
 
 
# move to original location or restore from tar if it exists
 
if [ -f $BACKUPDIR/$APP.tgz ] && [ $BACKUP -eq 1 ]
 
then
 
  echo "Restoring from tar backup...."
 
  cd /
 
  tar xzf $BACKUPDIR/$APP.tgz
 
  if [ $? -ne 0 ]
 
  then
 
  echo "Tar restore failed. Remove and restore app using official webOS/Pre methods."
 
  cleanexit 22
 
  else
 
  rm -r $BACKUPDIR/$APP.tgz
 
  fi
 
else
 
  echo "Restoring from $MEDIA..."
 
  cp -r  $MEDIA/$APP $VAR
 
  if [ $? != 0 ]
 
  then
 
  echo "Copy failed. Leaving app in $MEDIA."
 
  cleanexit 23
 
  fi
 
fi
 
 
 
rm -r $MEDIA/$APP
 
if [ $? != 0 ]
 
then
 
  echo "Remove failed. Leaving app in $MEDIA."
 
  rm -r $VAR/$APP
 
  cleanexit 24
 
fi
 
 
 
# rescan luna in case it's needed
 
luna-send -n 1 palm://com.palm.applicationManager/rescan {} >/dev/null 2>&1
 
 
 
echo "$APP moved and unlinked SUCCESSFULLY."
 
echo "Size of $VAR after move... "
 
/usr/bin/du -sh $VAR
 
}
 
# end of unlinkapp function
 
 
 
#-------------------------------------------------------------------------#
 
# function: bulkmv -  move/link many apps
 
#-------------------------------------------------------------------------#
 
bulkmv() {
 
echo
 
echo
 
echo "This allows moving many apps, asking which you'd like to move."
 
echo "Starting with the largest apps."
 
echo
 
 
 
 
 
mount -o remount,rw /
 
cd $VAR
 
 
 
for i in `/usr/bin/du -s * | sort -nr |cut -f 2`
 
do
 
    export APP=$i
 
    SIZE=`/usr/bin/du -sh $APP |cut -f 1`
 
    TITLE=`grep title $VAR/$APP/appinfo.json 2>/dev/null |cut -d: -f2 |cut -d\" -f2`
 
    echo
 
    echo
 
    echo "Size of $APP - $TITLE is $SIZE."
 
    echo "Would you like to move and link... $TITLE? [y/N/q]: "
 
    read answer
 
    case $answer in
 
    [Yy]*) linkapp;;
 
    [Qq]*) cleanexit 0;;
 
        *) echo "$APP not moved."
 
          continue;;
 
    esac
 
 
 
    echo
 
done
 
}
 
# end of bulkmv function
 
 
 
#-------------------------------------------------------------------------#
 
# function: restoreall - restore all apps, back to /var
 
#-------------------------------------------------------------------------#
 
restoreall() {
 
 
 
#Only confirm if PROMPT turned on. (allows outside app to call)
 
  if [ $PROMPTS -eq 1 ]
 
  then
 
  echo "This will restore all applications back to original location"
 
  echo "and remove the links.  Are you sure you want to continue? [y/N]:"
 
  read answer
 
  case $answer in
 
    [Yy]*) continue;;
 
        *) cleanexit 0;;
 
  esac
 
  fi
 
 
 
  ls $MEDIA | while read APP
 
  do
 
    echo "Restoring $APP and unlinking..."
 
    unlinkapp
 
  done
 
}
 
# end of restoreall function
 
 
 
#-------------------------------------------------------------------------#
 
# function: removetarbackups -  remove entire tar backup directory
 
#-------------------------------------------------------------------------#
 
removetarbackups() {
 
  echo "Tar backups are no longer needed and waste space on /media."
 
  echo "Backups are located in $BACKUPDIR"
 
  echo "Type \"remove\" to remove entire backup directory: "
 
  read answer
 
  case $answer in
 
  [Rr]emove) echo "Removing $BACKUPDIR..."
 
              if [ -d $BACKUPDIR ]
 
              then
 
              rm -r $BACKUPDIR
 
              fi 
 
              ;;
 
  esac       
 
}
 
# end of removetarbackups function
 
 
 
 
 
#-------------------------------------------------------------------------#
 
# main - begins here
 
#-------------------------------------------------------------------------#
 
 
 
mount -o remount,rw /
 
 
 
df |grep /media/internal 2>&1 >/dev/null
 
if [ $? != 0 ]
 
then
 
echo "USB drive is mounted to computer.  You must unmount from USB to use mvapp."
 
code=100
 
cleanexit $code
 
fi 
 
 
 
 
 
case $COMMAND in
 
"clean")
 
  cleanapp
 
  ;;
 
"list")
 
  listapps
 
  ;;
 
"listmoved")
 
  listmoved
 
  ;;
 
"link")
 
  linkapp
 
  ;;
 
"unlink")
 
  unlinkapp
 
  ;;
 
"bulkmv")
 
  bulkmv
 
  ;;
 
"restoreall")
 
  restoreall
 
  ;;
 
"ftr")  # force tar restore
 
  BACKUP=1 
 
  unlinkapp
 
  ;;
 
"rtb")  # remove all tar backups
 
  removetarbackups
 
  ;;
 
"info")
 
  info
 
  ;; 
 
*)
 
  usage 1
 
  ;;
 
esac
 
 
 
cleanexit $code
 
 
 
</pre>
 
  
 +
http://gitorious.org/webos-internals/mvapp
  
 
== Credits ==
 
== Credits ==

Revision as of 08:40, 23 October 2009

Based on rwhitby's findings that temporarily moving /var/usr/palm/applications will allow installing apps from the App Catalog, here's a permanent way to keep the apps on (much larger) /media/internal by using links. This will permanently save space on /var and allow more App Catalog apps to be installed, essentially up to near 8GB limit rather than the 64MB limit.


Overview

This solution involves creating a (hidden) directory in the /media/internal area, moving selected applications to the newly created directory, and then creating a symbolic link in the /var/usr/palm/applications directory pointing to the new location. This frees up the disk space from the relatively limited /var volume to the larger /media/internal. The included script (which must be created) will move the files and create the appropriate link. It will also provide information on the size of the applications stored in the /var/usr/palm/applications directory.

Solution (symbolic link method)

Install Option 1:

Now on PreWare in the Linux Applications category, thanks to Rod Whitby.

- Install 'MvApp' from PreWare in the Linux Applications category.
- run 'mvapp' from the Terminal app (also available on PreWare) within the phone.

Install Option 2:
To install versions in development..

Enter Linux mode on Pre through a computer (paste the section below)

mount -o remount,rw / 
cd /tmp
wget http://gitorious.org/webos-internals/mvapp/blobs/raw/master/mvapp
chmod 755 mvapp
mv mvapp /usr/local/bin/mvapp.dev  #or name to whatever you'd like
mvapp.dev


Quick Start Guide
- Install 'mvapp' from PreWare
- Install Terminal app from PreWare (if not already installed)
- Open Terminal from launcher, then type...
- mvapp bulkmv

Precautions

So far, no one has reported an app that has issues due to linking. These are best practices to avoid issues.

- Be selective about what you move. You may not want to move apps that store important information to you such as password lockers, memo apps, EverNote, Agenda, etc. Games, web content apps and information viewing apps should be safer to move as there is no data at risk.

- If Palm releases a new webOS that resolves the overall issue, you may need to completely restore your apps back to /var before performing the upgrade - mvapp restoreall. If the webOS update is applied before you get a chance to restore, it's possible it could break this method, which is why I do not recommend moving apps that store important information.

- This is a workaround script not approved by Palm. The usual disclaimers apply.

Commands

To find the largest apps in /var/usr/palm/applications

mvapp list

The first number is size of app in KB, largest shown last. IE....
8352 com.apnews.webos
8512 com.fandango.app.fandango
8672 com.palm.app.musicplayerremix
10304 com.shortcovers.palm.pre
10432 com.fusioncreativestudios.deadman
10656 com.ulocate.app.where


To move and link an app to /media

mvapp link domain.appname

Example: mvapp link com.ulocate.app.where

The app should now work in the new location thanks to the link. Test each app to make sure it works before doing another.

Continue moving apps until it reports that /var.../applications is about 30MB or less and /var has less than 90MB used.


To move and link many apps

mvapp bulkmv

This will show largest app first, ask if you want to move/link and then moves on to the next largest app. If you answer no to an app, it will skip to the next. Answer 'q' to quit. Is easiest to use this method directly on the phone using the Terminal app, available in Homebrew.


To revert the move and delete the link

mvapp unlink domain.appname

The application will be moved back to the original directory. If you have issues with an app after unlinking, see the Contingency Plan section below.


To list apps that have been moved and linked...

mvapp listmoved

This shows a list of apps that have been moved and linked to /media.


To restore all moved apps back to original location

mvapp restoreall

This will restore ALL applications that have been moved/linked, back to the original location in /var. This may take several minutes to complete. It will show each application progress. Beware that if you have moved a very large number of apps over a period of time, they may not all fit on /var. You may need to remove some/many unused apps before restoring all.


To cleanup and remove directories and symlinks

mvapp clean domain.appname

If you have any issues, first attempt to remove the app from Launcher, the App Catalog or Homebrew app installer. It's very important you remove from the phone first before using the clean command. Then issue the 'clean' command to remove the applications directories at both locations and also the symlink. You can then reinstall the app from the App Catalog or any Homebrew App installer.


To force tar restore

mvapp ftr domman.appname

This is a hidden function not shown in usage. It is for those who used an older version of mvapp and had tar backups. If you need to restore an app from tar, use this command. Or just remove the app from Launcher and reinstall if necessary.


To remove tar backups

mvapp rtb

This is a hidden function not shown in usage. Tar backups have been disabled by default since mvapp 0.2.4. Tar backup has been turned off because it wastes space on /media and has potential issues with restoring older versions of an app. Its purpose was to restore special file attributes not supported by FAT filesystem. The script no longer moves apps that FAT fs cannot support, so tar is no longer needed. If you no longer need old tar backups, use this command to remove the entire backup directory.

Contingency Plan

If you have problems with an application, follow these steps...
-- Close the application if open
-- mvapp unlink domain.appname
-- Try using the App

If the application still does now work correctly...
-- Remove the App using official methods (remove from Launcher or Homebrew installer)
-- mvapp clean domain.appname
-- Reinstall through the App Catalog or Homebrew installer app

Proposal to Dev Community

This is a formal proposal to the Dev Community suggesting that PreWare, WebOS Quick Install and other Pre installer apps provide an option to move any app in /var to the /media fs and create a link similar to the code above.

The Homebrew Community somewhat created part of the storage problem so needs to come up with their own solution. The symbolic link proponents propose that Homebrew apps be moved with a link to /media/internal by default and physically use /var only if needed (per conditions stated below). The developer would put a flag in the package (or some other method during submission) to state their app is able to run linked to /media or if it specifically needs to physically be on /var. Will propose additions to Packaging Standards to support /media links. The homebrew installer apps could then automatically do the move/link if the package is flagged for it.

Candidate apps for moving to /media
- apps that do not depend on file attributes not supported by FAT (such as sticky bit or internal links) - The script (post 0.2.0 now deals with this).
- apps that do not perform data operations to home app directory when device is USB mounted

Exceptions for maintaining apps on /var
- apps that depend on file attributes not supported by FAT - The script (post 0.2.0 now deals with this).
- apps that won't work well when device is USB mounted, such as performing data or DB operations in home app directory

(Please update with other known candidates/exceptions)

Benefits over other methods

Fair Dinkum method
Rod Whitby's FD method works tactically but doesn't resolve the issue of filling up /var space. A webOS update can use 30% of /var alone and the next update could have issues if too much /var space is used. The symlink method not only saves space on /var, it can reduce it significantly when many apps are moved.

Resizing /var
One challenge with resizing /var is that it will still have a fixed static limit - how do you decide how much to increase it? Many will still probably hit the limit or waste space if setting too high. There is also the warning from Palm that resizing var may interfere with future updates. The link method allows to dynamically use the /media partition, so there is no need to set a specific size dedicated to apps. If the USB drive is filled, users can decide if they use the space for media or apps on the fly.

AppPath in /etc/luna.conf
I proposed a while back adding an AppPath to luna.conf to include apps stored on /media. Some apps would not work because some apparently reference /var. IE, the vampire/mafia/quest series could not access graphics. The symbolic link fixed this because apps think they are in /var.

Link/mount all of /var/usr/palm/applications/ to /media/internal
If some apps rely on file attributes this won't work since file attributes are lost when moved to FAT fs. While this is rare, it probably isn't wise to force all /var apps to /media. Selectively moving apps one at a time is less risky. Update: Have found that "PDF View" app does not allow to be linked, so it appears that selectively moving apps is necessary.

Creating a loopback filesystem to a virtual file located on /media/internal
This has been worked on here and still has potential. Unfortunately it locks out USB mount and media sync altogether. If a workaround can be found with low risk, this may be the most ideal solution.

Risks, Issues, Dependencies

- Some file attributes of linux fs are not possible on FAT fs (USB drive). The 0.2.0 version (and higher) now deals with any apps that cannot copy attributes/permissions properly. The script will not move apps that have special attributes or conditions that FAT fs can't deal with. In general, this has been resolved. No known issues with apps since version 0.2.0 or later.

- Some apps may not behave well if USB drive is mounted to computer, though I've tested several that behaved fine. Linux type background services probably would not work well so probably should not be moved, however I'm not aware of any service stored in the app home directory - they are usually setup somewhere else. Apps that do IO to the home directory of the app while USB mounted may have issues when located on /media. I'm not aware of any apps that write to their own home directory, so this may not be a risk in general, but is still a possibility. If you run into issues with an app, see the Contingency Plan.

Future Versions

Plans for future versions...

- The script will soon be modified to be friendly for javascript calls... no prompting and no output, just result codes. Will still maintain user interaction capability as well.

Confirmed Apps

Apps Confirmed Not to Work

com.palm.app.pdfviewer (script v0.2.0 and higher properly handles this, won't allow it to move)

Discuss

Discuss in the Discussion tab or PreCentral...

http://forums.precentral.net/web-os-development/205649-resolution-app-catalog-install-limit-proposal.html

Your Experiences

Please post your experiences, good or bad. I'd like to get any kinks worked out before attempting to turn this into a webOS app.

- How many apps did you move?
- Did you find an app that won't work linked?
- Did you move any back? (please test)
- How far down did you have to get /var.../applications down in MB before you could start adding apps from the App Catalog?

Source

The source has been moved to gitorious...

http://gitorious.org/webos-internals/mvapp

Credits

xorg - initially developed script and proposal.  maintainer of this page.
daventx - added unlink and clean functions, other suggestions<br>
nt4cats - found Fair Dinkum breaks mvapp, gave solution to use explicit path.
SirWill, hparsons, bclancy, dhcalva, chodaboy - testing, usable suggestions and feedback
emoney22 - pointed out hidden directory in /media hides images from Photo app
greg_roll - provided info to capture running apps

And thanks to the many testers who gave feedback on the PreCentral thread.