UPDATE TUTORIAL jpeters


Preparation

Install the script as "update", preferably somewhere in your PATH so it can be called from anywhere. Update uses wget.tcz, dialog.tcz, diffutils.tcz, and the links.tcz browser by default. Use the update-build.sh script to create an update.tcz extension,  (e.g., "sh update-build.sh), or run as a script.  

Set script permissions with "sudo chmod +x ./update"

Update loads its own dependencies automatically, loading if in the tce dir (but not loaded) and fetching if not already downloaded. This is expecially useful if using update tools when restoring a failed boot.  To automatically
load tcl_tk (dep for "gupdate"), uncomment it in the load() section, lines 49,56.


GUPDATE

Gupdate is a GUI frontend for 'update' written in tcl-tk, and requires tcl_tk.tcz loaded and "update" placed in PATH or in the same folder to run.  It was written for those who prefer not to use a terminal. Options are noted in the dropdown menus, activated by just clicking. The rest of the tutorial uses the terminal without Gupdate.
Use the gupdate-build.sh script to create a gupdate.tcz extension (e.g., "sh gupdate-build.sh), or run as a script.    

Initial Setup: Database


When first run, update will install a /tce/db-md5 directory and prompt you to download an md5 database from
the repository. Use the option "update --database" to rebuild the database at any time.  Non database functions will work without it. 

For searches through list files, build listbase with "update --listbase."  This allows almost instantaneous offline searching.  'Listbase' is written within in the tce dir as "/db-list."

Basic Functions: Updating

1. Graphics Method 

                Type from terminal: "update -g"

This is the update graphics option using 'dialog'. If all is well, you should see extensions from your tce directory listed. Typing the first letter will move the list accordingly for faster selection. Select an extension and push <return>.

    For Updating extensions from the /tce/optional folder:
               
                   Type from Terminal" "update -og"


2. CLI Method To view extensions in the tce directory:

                     type: "update -v"

Choose an extension to update and type:

                    "update [basename]" eg, "update gnumeric"

 To update an extension from the optional dir, use the "-o" option:

                    "update -o <ext> "  eg, "update -o gnumeric"  

Push <enter> to update. Remember to use only the basename. Update searches the tce directory for the correct extension.

AUTOMATIC BACKUPS


Updated extensions are automatically copied to a backup folder in the tce directory. If an updated extension doesn't work out, simply restore the original from a list in Dialog:
                    
                        type:
"update --restore"


To delete extensions from the backup folder:

                    type: "update -rembak"

Failed updates are automatically restored to the tce directory.

FILE AND DEPENDENCY CHECKING

            type: "update -f [ basename ]" eg, "update -f" or  "update -f gnumeric"

Run using Dialog or directly from the terminal. Again, use only the basename as the script will search your tce directory for the correct extension. All  downloaded md5 files are copied from /tmp to the database, if one exists, to keep it current.

Check dependencies with the -d option:

           type: "update -d [ basename ]" eg, "update -d" or "update -d gnumeric"

Files that need updating (FAILED) are echoed to the terminal

               Checking the TCE directory for updates

The entire tce directory can be checked with:

                      type: "update -c"

This will download md5 files that are used to check all extensions in the tce directory. The downloaded files are copied into DB (if one exists), or else just deleted from /tmp/md5 after running its checks. This will take some time, depending on the size of the tce directory. Extensions that need updating (FAILED) are reported. "Update" avoids automatic batch functions for safety reasons, and checking updated extensions  is recommended (newer != better). If one doesn't work with your setup, the orginal can be restored from backup (update --restore)

The tce dir can be quickly checked with an updated database without downloading. This option can also be used to check for corruption. 

                      type: "update -cx" 

Dep files get checked automatically for changes with individual file and dependency checks. To check the entire tce dir for changes:
                  
                       type: "update -cd"

Using Update as an appsbrowser

                To mount a new extension:

                       type: "update -i"   

This command will download all associated md5 files from the repository, and list available extensions in 'dialog' for selection. Only files currently not in the database will be downloaded, and the database will be updated.               

                For downloads to tce/optional:

                            type: "update -id"

                For fast mounts, installs, or downloads using the updated database:

                             type: "update -ix" 
                       
                             type:  "update -idx"

This produces rapid listing in 'dialog' of files for installing, since no downloading is required.

    VIEW DIRECTORIES
                To view files in the tce directory:
           
                           type: "update -v"

                To view files in the database:

                             type: "update -vx"

                To view files in the /optional directory:
                            
                        type: "update -vo"

               To view installed extensions
                     
                           
type: "update -ve"

                To view depencencies  in the tce dir; also shows "missing" extensions. 

                        type: "update -vd"


Search Functions

Search the Database:

Use option "-s" for a rapid search of the database DB. Partial names will list all extensions that include the entry: 

                     example: "update -s perl"

Search for inclusion within dependency files in the tce_dir using "-sd" option. Select from Dialog or enter directly:

                 example: "update -sd" or  "update -sd fontconfig"

Search through listbase (if present) for extensions that use the search file.
 
                 example:  "update -sl soundon"   Finds files associated with OSS extension 

Removing extensions from the TCE Directory

            type: "update -rem"

This command will list extensions in the tce directory to 'dialog' for removal from your tce directory. The main point of this option is so the extensions will not be loaded on subsequent boots. Before deleting an extension, check that it's not a dependency of anything else with "update -sd [extension]".  Removed extensions are umounted and symlinks deleted, and can be reinstalled without rebooting. 

Extensions can also be removed directly without 'dialog'

            type: "update -rem [ basename ]   eg, "update -rem gnumeric"


                               Removing extensions from the /optional directory

            type: "update -remop"

This command uses the graphic dialog box for selection

Viewing info, list, or dep files

Update will search the repository for .list, .dep, and .info files, download them to /tmp/info, and read them to terminal. If the search yields multiple files eg, "update -list python",  the files involved will be listed and then read as one file.  As usual, type only the base name. If you want to see all the vim files, type:
                      
                                 "update -info vim"

For deps (dependencies) or files included use the -dep or -list options:

                               type: "update -dep gnumeric"
                                      type: "update -list gnumeric"

Beginning with version 2.5, a browser option is included for fast viewing without the need to download anything. The BROWSER path is edited at the top of the script (links.tcz is recommended). A database will also be needed for this option.  Shortcuts will use the browser if present, or download files if not present. Select from Dialog or enter choice directly:

                             type:  "update -inf" or "update -inf gnumeric"
                                        "update -ls" or "update -ls  gnumeric"
                                        "update -dp" or "update -dp gnumeric"


 Reference

A complete listing of options is available with:

               type: "update --help"

 Closing Comments

Although generally a reboot is all that is necessary to restore a PPR system, it's been said that it's safer not to remove or update extensions that are currently in use. That said, precautions such as umounting tcz's and deleting symlinks are included with update options to minimize the necessity of having to reboot. In my own testing, I haven't run across an instance yet in which I've needed to reboot or that anything has "broken", but rebooting is always an easy option. Batch updating is deliberately avoided, since downloads can fail or updated extensions flawed in a way that breaks your system. An updated extension that doesn't work with your setup can be immediately restored from backup.


Have fun using "update"

jpeters