Diff from pkgfe-20061003.tar.gz to pkgfe-20061204.tar.gz

 

--- pkgfe-20061003/pkgfe Tue Oct 3 13:12:08 2006 +++ pkgfe-20061204/pkgfe Mon Dec 4 05:17:11 2006
@@ -1,6 +1,12 @@ #!/bin/sh - ############################################################################### + # + # Package Frontend. + # + # By: Sulev-Madis Silber <madis555 at hot dot ee> + # + # + ############################################################################### # Configuration file
@@ -37,20 +43,41 @@ # plural() { - if [ "$1" -a "$1" -ne 1 ] + if [ ! "$1" ] then + ierror 'plural: invalid parameters' + fi + + + if [ "$1" -ne 1 ] + then echo s fi } # - # Removes file + # Removes "'" from a stream. # + makesafe() + { + tr -d "'" + } + + + # + # Removes file. + # unlink_file() { - if [ "$1" -a -f "$1" ] + if [ ! "$1" ] then + ierror 'unlink_file: invalid parameters' + fi + + + if [ -f "$1" ] + then rm -f "$1" fi }
@@ -61,33 +88,74 @@ # error() { - if [ "$1" ] + if [ ! "$1" ] then - echo "`prog`: $1" - - cleanexit 1 + ierror 'error: invalid parameters' fi + + + echo "`prog`: $1" >&2 + + cleanexit 1 } # + # Prints internal error and exits. + # + ierror() + { + if [ ! "$1" ] + then + ierror 'ierror: invalid parameters' + fi + + + echo "`prog`: internal error: $1" >&2 + + cleanexit 1 + } + + + # # Prints error. # notice() { - if [ "$1" ] + if [ ! "$1" ] then - echo "`prog`: $1" + ierror 'notice: invalid parameters' fi + + + echo "`prog`: $1" >&2 } # + # Prints usage and exits. + # + usage() + { + if [ ! "$1" ] + then + ierror 'usage: invalid parameters' + fi + + + echo "usage: `prog` $1" >&2 + + cleanexit 1 + } + + + # # Does clean exit. # cleanexit() { - unlink_file "$LOCKFILE" + del_tempfile + unlink_file "$lock_file" exit ${1:-0} }
@@ -98,14 +166,15 @@ # exitcode() { - if [ $# -ne 2 ] + if [ ! "$1" -o ! "$2" ] then - return 1 + ierror 'exitcode: invalid parameters' fi echo error "command '$1' failed with exit code $2" + echo }
@@ -116,7 +185,7 @@ { if [ ! "$1" ] then - return 1 + ierror 'showcmd: invalid parameters' fi
@@ -132,7 +201,7 @@ { if [ ! "$1" ] then - return 1 + ierror 'checkyesno: invalid parameters' fi
@@ -178,32 +247,40 @@ # - # Creates temporary files. + # Creates temporary file. # - make_temp() + make_tempfile() { - if [ ! "$TEMP_PREFIX" ] + touch "$temp_file" + + if cmd_failed $? then - error 'internal error: $TEMP_PREFIX is empty' + error "cannot create temp file '$temp_file'" fi - - - mktemp "$TEMP_PREFIX.XXX" || error 'mktemp error' } # + # Deletes temporary file. + # + del_tempfile() + { + unlink_file "$temp_file" + } + + + # # Shows menu or checklist using dialog(1). # show_dialog() { if [ $# -ne 3 -a $# -ne 4 ] then - return 1 + ierror 'show_dialog: invalid parameters' fi - local name text options type options_tempfile exitcode selected_options + local name text options type stderr_file exitcode selected_options name=$1
@@ -211,56 +288,63 @@ options=$3 type=checklist + stderr_file="$temp_file" case $4 in ''|checklist) - options_tempfile=`make_temp` + make_tempfile ;; menu) type=$4 + + stderr_file=/dev/null ;; *) - unset name text options type options_tempfile exitcode selected_options - - return 1 + ierror 'show_dialog: invalid type' ;; esac - if [ ! "$options" ] + if [ ! "$name" ] then - error 'internal error: $options is empty' + ierror 'show_dialog: name is empty' + + elif [ ! "$text" ] + then + ierror 'show_dialog: text is empty' + + elif [ ! "$options" ] + then + ierror 'show_dialog: options is empty' fi - eval "dialog --title '`prog`: $name' \ - --$type '\n$text\n' \ - -1 -1 $dialog_list_rows \ - $options \ - 2> '${options_tempfile:-/dev/null}'" + eval "dialog --title '`prog`: $name'"\ + "--$type '\n$text\n'"\ + "-1 -1 $dialog_list_rows"\ + "$options"\ + "2> '$stderr_file'" exitcode=$? eval selopt_${name}_exitcode=\$exitcode - unset text options exitcode + unset text options stderr_file exitcode if [ "$type" = checklist ] then - selected_options=`sed 's|"||g' < "$options_tempfile"` + selected_options=`sed 's|"||g' < "$temp_file"` - unlink_file "$options_tempfile" + del_tempfile - unset options_tempfile - eval selopt_${name}_values="\$selected_options" unset selected_options
@@ -275,13 +359,13 @@ # show_confirm() { - if [ $# -ne 2 -a "$1" -a "$2" ] + if [ ! "$1" -o ! "$2" ] then - return 1 + ierror 'show_confirm: invalid parameters' fi - local type package packages count dialog_options confirm_message cancel_message + local type package comment packages count dialog_options confirm_message cancel_message type=$1
@@ -292,10 +376,21 @@ do count=$(($count + 1)) - dialog_options="$dialog_options '$package' ' '" + + comment=' ' + + if [ "$type" = upgrade ] + then + if checkyesno upgrade_show_new_version + then + comment=`grep "$package" "$status_file" | awk '{print $2}'` + fi + fi + + dialog_options="$dialog_options '$package' '$comment'" done - unset package packages + unset package comment packages case $type
@@ -319,7 +414,7 @@ ;; *) - error "show_confirm: internal error: invalid type '$type'" + ierror 'show_confirm: invalid type' ;; esac
@@ -345,6 +440,40 @@ # + # Shows packages before executing + # install, upgrade or deinstall. + # + show_packages() + { + if [ ! "$1" -o ! "$2" ] + then + ierror 'show_packages: invalid parameters' + fi + + + local package + + + echo + echo "$1:" + echo + + shift + + + for package in $* + do + echo "$package" + done + + + echo + + unset package + } + + + # # Shows package deinstall dialog. # package_deinstall()
@@ -368,11 +497,9 @@ show_confirm deinstall "$packages" - command="pkg_deinstall $packages" + command="${root_command_prefix}pkg_deinstall $packages" - unset packages - if ! checkyesno enable_real_deinstall then cat <<- EOF
@@ -387,6 +514,11 @@ fi + show_packages Deinstalling $packages + + unset packages + + showcmd "$command" $command
@@ -418,9 +550,13 @@ # do_help() { - grep -A100 '^#__HELP__$' "$0" | \ - sed "s|^#||; s|^__HELP__||; s|%P%|`prog`|g; s|%PORTS_PATH%|$PORTS_PATH|g; s|%PKGDB_PATH%|$PKGDB_PATH|g" + cat <<- EOF + Help of `prog` is now moved to man page, + see pkgfe(8) + + EOF + cleanexit }
@@ -431,24 +567,24 @@ # do_list() { - local tempfile command exitcode count + local command exitcode count - tempfile=`make_temp` + make_tempfile - command='portversion -vl <' + command="${root_command_prefix}portversion -vl <" showcmd "$command" - $command > "$tempfile" + $command > "$temp_file" exitcode=$? if cmd_failed $exitcode then - unlink_file "$tempfile" + del_tempfile exitcode "$command" $exitcode fi
@@ -457,32 +593,31 @@ sed 's|<||; s|needs updating (port has ||; s|) *$||; s|) (| |' \ - < "$tempfile" \ - > "$status_file" + < "$temp_file" | \ + makesafe > "$status_file" - unlink_file "$tempfile" + del_tempfile if ! checkyesno ignore_held then - tempfile=`make_temp` + make_tempfile - cat "$status_file" > "$tempfile" + cat "$status_file" > "$temp_file" - grep -v '\[held\]' < "$tempfile" > "$status_file" + grep -v '\[held\]' < "$temp_file" > "$status_file" - unlink_file "$tempfile" + del_tempfile fi - unset tempfile - count=`wc -l "$status_file" | awk '{print $1}'` echo echo '-----------------------------------' echo "Found $count outdated package`plural $count`" echo '-----------------------------------' + echo if [ "$count" -eq 0 -a "$1" = exit-if-none ]
@@ -491,9 +626,6 @@ fi unset count - - - echo }
@@ -506,10 +638,10 @@ local command exitcode - check_supfile "$csup_supfile" + check_supfile - command="csup $csup_args $csup_supfile" + command="${root_command_prefix}csup $csup_args $csup_supfile" showcmd "$command"
@@ -524,7 +656,7 @@ fi - command='portsdb -Fu' + command="${root_command_prefix}portsdb -Fu" echo showcmd "$command"
@@ -556,8 +688,13 @@ local command exitcode - command='portsnap fetch' + command="${root_command_prefix}portsnap fetch" + if ! checkyesno old_portsnap + then + command="$command update" + fi + showcmd "$command" $command
@@ -571,23 +708,26 @@ fi - command='portsnap update' - - echo - showcmd "$command" - - $command - - - exitcode=$? - - if cmd_failed $exitcode + if checkyesno old_portsnap then - exitcode "$command" $exitcode + command="${root_command_prefix}portsnap update" + + echo + showcmd "$command" + + $command + + + exitcode=$? + + if cmd_failed $exitcode + then + exitcode "$command" $exitcode + fi fi - command='portsdb -u' + command="${root_command_prefix}portsdb -u" echo showcmd "$command"
@@ -619,7 +759,7 @@ local command exitcode - command='pkgdb -F' + command="${root_command_prefix}pkgdb -F" showcmd "$command"
@@ -659,12 +799,6 @@ case $search_string in name|key) - if [ ! "$2" ] - then - error 'usage: name|key searchstring' - fi - - search_string=$2 type=$1
@@ -674,7 +808,7 @@ if [ ! "$search_string" ] then - error 'empty search string' + usage 'find [name|key] [regex]' fi
@@ -682,57 +816,119 @@ cd "$PORTS_PATH" || cleanexit 1 - make search "$type=$search_string" | "$PAGER_PROGRAM" + make_tempfile + + make search "$type=$search_string" > "$temp_file" + + + if [ ! -s "$temp_file" ] + then + del_tempfile + + echo + error "no matches for '$search_string'" + fi + unset search_string type + clear + + "$PAGER_PROGRAM" "$temp_file" + + del_tempfile + + cleanexit } # # Command: + # does "make config" in port's directory. + # + do_config() + { + local portpath + + + portname=$1 + + + if [ ! "$portname" ] + then + usage 'c [port]' + fi + + + portpath=`whereis -sB "$PORTS_PATH" -f "$portname" | cut -d ' ' -f 2` + + + if [ ! -d "$portpath" ] + then + error "port '$portname' not found" + fi + + + showcmd "cd $portpath && make config" + + cd "$portpath" || cleanexit 1 + + ${root_command_prefix}make config + + unset portpath + + + cleanexit + } + + + # + # Command: # does search in ports tree # and shows install dialog. # do_find_install() { - local tempfile search_string index_file name comments count dialog_options + local search_string index_file name comments count dialog_options search_string=$1 + index_file="$PORTS_PATH/INDEX-`uname -r | cut -d . -f 1`" - if [ -f "$PORTS_PATH/INDEX-6" ] + + if [ ! -f "$index_file" ] then - index_file="$PORTS_PATH/INDEX-6" - - elif [ -f "$PORTS_PATH/INDEX" ] - then - index_file="$PORTS_PATH/INDEX" - - else - error 'no valid INDEX found' + if [ -f "$PORTS_PATH/INDEX" ] + then + index_file="$PORTS_PATH/INDEX" + else + error "no valid INDEX file found under '$PORTS_PATH'" + fi fi if [ ! "$search_string" ] then - error 'search regex is required' + usage 'findi [regex]' fi - tempfile=`make_temp` + make_tempfile - grep -iE "$search_string" "$index_file" | cut -d '|' -f 1,4 | tr '|' ' ' > "$tempfile" + cut -d '|' -f 1,4 "$index_file" | makesafe | grep -iE -- "$search_string" | \ + awk -F '|' '{print $1" "(length($2) > '$findi_description_length' ? substr($2, 0, '$findi_description_length')"..." : $2)}' \ + > "$temp_file" + unset index_file - if [ ! -s "$tempfile" ] + if [ ! -s "$temp_file" ] then - unlink_file "$tempfile" + del_tempfile error "no packages matching '$search_string' found" fi
@@ -740,20 +936,25 @@ unset search_string + count=`wc -l "$temp_file" | awk '{print $1}'` + + echo + echo "$count result`plural $count` found. Generating dialog..." + echo + + while read name comments do - count=$(($count + 1)) - - dialog_options="$dialog_options '$name' '`echo "$comments" | awk '{print substr($0, 0, 26)}'`...' OFF" + dialog_options="$dialog_options '$name' '$comments' OFF" done \ - < "$tempfile" + < "$temp_file" - unlink_file "$tempfile" + del_tempfile - unset name comments tempfile + unset name comments - show_dialog find "Found $count package`plural $count`.\nSelect one`plural $count` you want to install" "$dialog_options" checklist + show_dialog find "Found $count package`plural $count`.\nSelect one`plural $count` you want to install" "$dialog_options" unset count dialog_options
@@ -786,13 +987,13 @@ if [ ! "$search_string" ] then - error 'search regex is required' + usage 'ls [regex]' fi ls -1 "$PKGDB_PATH" | \ - grep -v ^pkgdb\. | \ - grep -iE "$search_string" + grep -v '^pkgdb\.' | \ + grep -iE -- "$search_string" if cmd_failed $?
@@ -821,13 +1022,18 @@ cd "$PKGDB_PATH" || cleanexit 1 - for name in * + for name in `ls -1 | grep -v '^pkgdb\.' | makesafe` do - if [ ! $name = pkgdb.db -a ! -f $name/+REQUIRED_BY ] + count=$(($count + 1)) + + + if [ ! -f $name/+REQUIRED_BY ] then - count=$(($count + 1)) - dialog_options="$dialog_options '$name' 'no +REQUIRED_BY' OFF" + + elif [ ! -s $name/+REQUIRED_BY ] + then + dialog_options="$dialog_options '$name' 'empty +REQUIRED_BY' OFF" fi done
@@ -859,12 +1065,14 @@ cd "$PKGDB_PATH" || cleanexit 1 - for name in * + for name in `ls -1 | grep -v '^pkgdb\.' | makesafe` do - if [ ! $name = pkgdb.db ] + count=$(($count + 1)) + + if [ -f $name/+REQUIRED_BY ] then - count=$(($count + 1)) - + dialog_options="$dialog_options '$name' 'Required by others' OFF" + else dialog_options="$dialog_options '$name' ' ' OFF" fi done
@@ -892,7 +1100,7 @@ local command exitcode - command="portaudit -Fd" + command="${root_command_prefix}portaudit -Fd" showcmd "$command"
@@ -915,12 +1123,61 @@ # # Command: + # shows upgrade dialog. + # + do_upgrade() + { + local name comments count dialog_options + + + if [ ! -s "$status_file" ] + then + do_list exit-if-none + fi + + + count=`wc -l "$status_file" | awk '{print $1}'` + + + while read name comments + do + dialog_options="$dialog_options '$name' '< $comments' OFF" + done \ + < "$status_file" + + unset name comments + + + show_dialog list "Found $count outdated package`plural $count`\nSelect one`plural $count` you want to upgrade" "$dialog_options" + + unset count dialog_options + + + if [ ! "$selopt_list_values" ] + then + echo + echo 'No packages selected for upgrade' + echo + + cleanexit + fi + + + show_confirm upgrade "$selopt_list_values" + + + do_portinstall_portupgrade portupgrade $selopt_list_values + } + + + # + # Command: # runs portinstall(1) or portupgrade(1) with # verbose mode and additional arguments. # do_portinstall_portupgrade() { - local program command exitcode + local program message command exitcode program=$1
@@ -930,22 +1187,36 @@ case $program in - portinstall|portupgrade) + portinstall) + message=Installing ;; + + portupgrade) + message=Upgrading + ;; + *) - error "do_portinstall_portupgrade: internal error: invalid program '$program'" + ierror 'do_portinstall_portupgrade: invalid program' ;; esac + if [ ! "$*" ] + then + ierror 'do_portinstall_portupgrade: arguments cannot be empty' + fi + + + show_packages $message $* + + if checkyesno update_portaudit_db then - echo do_padb fi - command="$program -v $portupgrade_args $*" + command="$root_command_prefix$program $portupgrade_args $*" showcmd "$command"
@@ -970,8 +1241,6 @@ unset program command exitcode - echo - cleanexit }
@@ -988,17 +1257,19 @@ exitcode=0 - echo 'Checking for existence of required programs...' + echo 'Checking for existence of binaries we need...' echo - for binary in portupgrade portversion \ - dialog csup portsdb pkgdb portaudit \ - pkg_deinstall $PAGER_PROGRAM \ - sed grep cat touch id uname cut portsnap + for binary in portupgrade portinstall portversion \ + dialog csup portsdb pkgdb portaudit pkg_deinstall \ + "$PAGER_PROGRAM" sed grep cat touch id uname cut \ + portsnap awk wc whereis do + which "$binary" > /dev/null + if cmd_failed $? then notice "$binary: program not found"
@@ -1017,39 +1288,148 @@ # - # Checks configuration file. + # Command: + # shows configuration. # - check_configfile() + do_showconfig() { - if [ ! -f "$1" ] + local default + + + if [ ! -f "$CONFIG_FILE" ] then - error "$1: configuration file not found" + notice "configuration file '$CONFIG_FILE' is not found" - elif [ ! -r "$1" ] + default=1 + + elif [ ! "$root_command_prefix" -a ! -r "$CONFIG_FILE" ] then - error "$1: configuration file not readable" + notice "configuration file '$CONFIG_FILE' is not readable" + + default=1 fi + + + echo + + if [ "$default" ] + then + echo 'using default configuration:' + else + echo "$CONFIG_FILE:" + fi + + unset default + + + cat <<- EOF + --------------------------------------------------------------------- + + portupgrade_logdir="$portupgrade_logdir" + + portupgrade_args="$portupgrade_args" + + csup_supfile="$csup_supfile" + + csup_args="$csup_args" + + root_command_prefix="$root_command_prefix" + + status_file="$status_file" + + lock_file="$lock_file" + + temp_file="$temp_file" + + dialog_list_rows="$dialog_list_rows" + + findi_description_length="$findi_description_length" + + listup_after_upgrade="$listup_after_upgrade" + + ignore_held="$ignore_held" + + update_portaudit_db="$update_portaudit_db" + + enable_real_deinstall="$enable_real_deinstall" + + listup_after_deinstall="$listup_after_deinstall" + + old_portsnap="$old_portsnap" + + --------------------------------------------------------------------- + EOF + + + cleanexit } # + # Checks boolean variables in configuration file. + # + check_boolean_variables() + { + local variable + + + for variable in \ + listup_after_upgrade \ + ignore_held \ + update_portaudit_db \ + enable_real_deinstall \ + listup_after_deinstall \ + old_portsnap \ + upgrade_show_new_version + do + checkyesno $variable + done + + unset variable + } + + + # + # Checks numeric variables in configuration file. + # + check_numeric_variables() + { + local variable value + + + for variable in \ + dialog_list_rows \ + findi_description_length + do + eval value=\$$variable + + case "$value" + in + [0-9]|[0-9][0-9]) + ;; + + *) + error "variable '$variable' has invalid or not numeric value in '$CONFIG_FILE'" + ;; + esac + done + + unset variable value + } + + + # # Checks (and creates) status file. # check_statusfile() { - if [ ! "$1" ] + if [ ! -f "$status_file" ] then - error "please define status_file in $CONFIG_FILE" - fi - - - if [ ! -r "$1" ] - then - touch "$1" + touch "$status_file" if cmd_failed $? then - error "cannot create status file '$1'" + error "cannot create status file '$status_file'" fi fi }
@@ -1060,13 +1440,17 @@ # check_supfile() { - if [ ! "$1" ] + if [ ! "$csup_supfile" ] then - error "please define csup_supfile in $CONFIG_FILE" + error "please define csup_supfile in '$CONFIG_FILE'" - elif [ ! -r "$1" ] + elif [ ! -f "$csup_supfile" ] then - error "$1: file not readable" + error "supfile '$csup_supfile' is not found" + + elif [ ! "$root_command_prefix" -a ! -r "$csup_supfile" ] + then + error "supfile '$csup_supfile' is not readable" fi }
@@ -1076,19 +1460,19 @@ # check_portupgrade_logdir() { - if [ ! "$1" ] + if [ ! "$portupgrade_logdir" ] then return 0 fi - if [ ! -d "$1" ] + + if [ ! -d "$portupgrade_logdir" ] then - notice "$1: directory not found" + notice "portupgrade log directory '$portupgrade_logdir' is not found" - elif [ ! -w "$1" ] + elif [ ! "$root_command_prefix" -a ! -w "$portupgrade_logdir" ] then - notice "$1: directory not writable" - + notice "portupgrade log directory '$portupgrade_logdir' is not writable" else return 0 fi
@@ -1112,15 +1496,9 @@ # check_lockfile() { - if [ ! "$LOCKFILE" ] + if [ -f "$lock_file" ] then - error 'internal error: LOCKFILE is empty' - fi - - - if [ -f "$LOCKFILE" ] - then - notice "lock file '$LOCKFILE' exists" + notice "lock file '$lock_file' exists" cat <<- EOF
@@ -1133,27 +1511,45 @@ before you can run `prog` again. EOF - exit 1 + cleanexit 1 fi - touch "$LOCKFILE" + touch "$lock_file" if cmd_failed $? then - notice "cannot create lock file '$LOCKFILE'" - exit 1 + error "cannot create lock file '$lock_file'" fi } - ################################################## + # + # Checks for privileges. + # + check_privs() + { + if [ `id -u` -gt 0 ] + then + if [ ! "$root_command_prefix" ] + then + notice 'please switch to root' + + cat <<- EOF + + Alternatively, define root_command_prefix + in $CONFIG_FILE + EOF + + cleanexit 1 + fi + else + root_command_prefix= + fi + } - if [ `id -u` -gt 0 ] - then - error 'requires root' - fi + ############################################################################### if [ `uname -s` != FreeBSD ] then
@@ -1161,43 +1557,57 @@ fi - ################################################## + if [ -f "$CONFIG_FILE" -a -r "$CONFIG_FILE" ] + then + . "$CONFIG_FILE" + fi - check_configfile "$CONFIG_FILE" - . "$CONFIG_FILE" - - - : ${portupgrade_args=""} - : ${csup_args=""} + : ${portupgrade_logdir=""} + : ${portupgrade_args="-v"} + : ${csup_supfile=""} + : ${csup_args="-L 2"} + : ${root_command_prefix="sudo "} + : ${status_file="$TEMP_DIR/`prog`.status"} + : ${lock_file="$TEMP_DIR/`prog`.lock"} + : ${temp_file="$TEMP_DIR/`prog`.tmp"} : ${dialog_list_rows="10"} + : ${findi_description_length="26"} : ${listup_after_upgrade="YES"} : ${ignore_held="YES"} : ${update_portaudit_db="YES"} : ${enable_real_deinstall="NO"} : ${listup_after_deinstall="YES"} + : ${old_portsnap="NO"} + : ${upgrade_show_new_version="NO"} - check_portupgrade_logdir "$portupgrade_logdir" + check_boolean_variables - check_statusfile "$status_file" + check_numeric_variables + check_privs - TEMP_PREFIX="$TEMP_DIR/`prog`.tmp" + check_portupgrade_logdir - LOCKFILE="$TEMP_DIR/`prog`.lock" check_lockfile + check_statusfile - trap 'cleanexit 1' 2 15 + trap 'cleanexit 1' 1 2 15 30 31 - ################################################## + ############################################################################### + case $1 in + '') + do_upgrade + ;; + listup|list) do_list
@@ -1216,6 +1626,23 @@ cleanexit ;; + all) + do_csup + do_upgrade + ;; + + snap+run) + + do_portsnap + do_upgrade + ;; + + listup+run|list+run) + + do_list + do_upgrade + ;; + fixdb|fix) do_fixdb
@@ -1223,17 +1650,26 @@ find|portfind) - do_find "$2" "$3" + shift + do_find "$1" "$2" ;; + config|conf|c) + + shift + do_config "$1" + ;; + findi|findv) - do_find_install "$2" + shift + do_find_install "$1" ;; ls|lspkg) - do_ls "$2" + shift + do_ls "$1" ;; chkreq|notreq|noreq)
@@ -1251,24 +1687,27 @@ cleanexit ;; - all) - do_csup - ;; - - listup+run|list+run) - - do_list - ;; - install|i) shift + + if [ ! "$*" ] + then + usage 'i [port]' + fi + do_portinstall_portupgrade portinstall $* ;; upgrade|u) shift + + if [ ! "$*" ] + then + usage 'u [port]' + fi + do_portinstall_portupgrade portupgrade $* ;;
@@ -1276,103 +1715,18 @@ do_checkbinaries ;; + showconf) + + do_showconfig + ;; + help) do_help ;; - '') - ;; - *) - error "$1: invalid parameter" + error "invalid parameter '$1'" ;; esac - + cleanexit - ################################################## - - if [ ! -s "$status_file" ] - then - do_list exit-if-none - fi - - - while read name comments - do - count=$(($count + 1)) - - dialog_options="$dialog_options '$name' '< $comments' OFF" - done \ - < "$status_file" - - unset name comments - - - show_dialog list "Found $count outdated package`plural $count`\nSelect one`plural $count` you want to upgrade" "$dialog_options" - - unset count dialog_options - - - if [ ! "$selopt_list_values" ] - then - echo - echo 'No packages selected for upgrade' - echo - - cleanexit - fi - - - show_confirm upgrade "$selopt_list_values" - - - do_portinstall_portupgrade portupgrade $selopt_list_values - - - #__HELP__ - # Package Frontend help - #----------------------- - # - #%P% Show upgrade dialog - # - #%P% list Update list of outdated packages, - # using "portversion -vl <" - # - #%P% cvs Update ports tree using csup - # Run "portsdb -Fu" - # Run %P% list - # - #%P% snap Update ports tree using portsnap - # Run %P% list - # - #%P% all Run %P% cvs - # Run %P% - # - #%P% snap+run Run %P% snap - # Run %P% - # - #%P% list+run Run %P% list - # Run %P% - # - #%P% fix Run "pkgdb -F" - # - #%P% find Run "make search" in %PORTS_PATH% - # - #%P% findi Search for packages and show install dialog - # - #%P% ls Search packages in %PKGDB_PATH% - # - #%P% noreq Check for not required packages - # - #%P% deins Deinstall package(s) by name - # - #%P% padb Update portaudit database, using "portaudit -Fd" - # - #%P% i Run portinstall with -v $portupgrade_args - # - #%P% u Run portupgrade with -v $portupgrade_args - # - #%P% chkbin Check for existence of required programs - # - #%P% help This help - #

 

--- pkgfe-20061003/pkgfe.conf Tue Oct 3 13:12:08 2006 +++ pkgfe-20061204/pkgfe.conf Mon Dec 4 05:17:11 2006
@@ -1,38 +1,59 @@ + ################################################## # + # Package Frontend configuration file. + # + # + # This file is actually sourced in by sh(1), + # so please DON'T put anything other than + # variable="value" here. + # + ################################################## + + + # # Log directory for portupgrade(1). # # If set, writable directory is required. # + # Default: "" + # - #portupgrade_logdir=/tmp/pkgfe-logs + #portupgrade_logdir="/tmp/pkgfe-logs" #portupgrade_logdir=~/.pkgfe-logs - #portupgrade_logdir=/usr/local/portupgrade + #portupgrade_logdir="/usr/local/portupgrade" # # Additional arguments for portupgrade(1). # - # Default: None, except "-v" which is always specified. + # Default: "-v" # + #portupgrade_args="-v" #portupgrade_args="-L ${portupgrade_logdir}/%s::%s.log -l ${portupgrade_logdir}/all.log" + #portupgrade_args="-vbe -L ${portupgrade_logdir}/%s::%s.log -l ${portupgrade_logdir}/all.log" + #portupgrade_args="-vbe" # # Configuration file for csup(1). + # Only required when updating the ports tree + # using csup(1). # - # Only required when updating the ports tree. + # Note: please look "pkgfe snap". # + # Default: "" + # #csup_supfile=~/ports-supfile - #csup_supfile=/usr/share/examples/cvsup/ports-supfile + #csup_supfile="/usr/share/examples/cvsup/ports-supfile" # # Additional arguments for csup(1). # - # Default: None + # Default: "-L 2" # #csup_args="-L 2"
@@ -40,29 +61,82 @@ # + # Use root only when it's absolutely required. + # Otherwise, run as unprivileged user. + # + # Note: It's automatically set to "" + # if pkgfe runs under root. + # + # Default: "sudo " + # + + #root_command_prefix="su -lc " + #root_command_prefix="sudo " + #root_command_prefix="echo --- " + + + # # Status file. Used for storing # current list of outdated packages. # - # *Required!* + # Default: "TEMPDIR/PROGNAME.status" # - #status_file=/tmp/pkgfe.status + #status_file="/tmp/pkgfe.status" #status_file=~/.pkgfe.status # + # Lock file. Used to prevent + # multiple sessions of pkgfe. + # + # Default: "TEMPDIR/PROGNAME.lock" + # + + #lock_file="/tmp/pkgfe.lock" + #lock_file=~/.pkgfe.lock + + + # + # Temporary file. Used for + # pkgfe's temporary data. + # + # Default: "TEMPDIR/PROGNAME.tmp" + # + + #temp_file="/tmp/pkgfe.tmp" + #temp_file=~/.pkgfe.tmp + + + # # How much rows to display at once. # For example, about 10 when you are # using 80x24 terminal. # - # Default: 10 + # Default: "10" # #dialog_list_rows="10" #dialog_list_rows="15" #dialog_list_rows="20" + #dialog_list_rows="30" + # + # How many characters of port description + # to show per line, when displaying findi dialog. + # Truncates line and suffixes if with "...", + # if it's longer. + # For example, about 26 when you are + # using 80x24 terminal. + # + # Default: "26" + # + + #findi_description_length="26" + #findi_description_length="50" + + ################################################## # # Enable feature: "YES", "TRUE", "ON", or "1"
@@ -74,7 +148,7 @@ # Update list of outdated packages # after successful upgrade. # - # Default: YES + # Default: "YES" # #listup_after_upgrade="YES"
@@ -84,7 +158,7 @@ # Ignore packages those are held by user, # using the HOLD_PKGS variable in pkgtools.conf(5). # - # Default: YES + # Default: "YES" # #ignore_held="YES"
@@ -94,10 +168,11 @@ # Update portaudit database # before each upgrade. # - # Default: YES + # Default: "YES" # #update_portaudit_db="YES" + #update_portaudit_db="NO" #
@@ -105,18 +180,39 @@ # not just printing out the command # when using "pkgfe deins" feature. # - # Default: NO + # Default: "NO" # #enable_real_deinstall="NO" + #enable_real_deinstall="YES" # # Update list of outdated packages # after successful deinstall. # - # Default: YES + # Default: "YES" # #listup_after_deinstall="YES" + + + # + # Enable when your portsnap don't support + # "fetch update", only "fetch" and "update". + # + # Default: "NO" + # + + #old_portsnap="NO" + + + # + # Show new version in confirm upgrade dialog. + # A bit slow. + # + # Default: "NO" + # + + #upgrade_show_new_version="NO"

 

--- pkgfe-20061003/pkgfe.8 +++ pkgfe-20061204/pkgfe.8 Mon Dec 4 05:17:11 2006
@@ -0,0 +1,93 @@ + .Dd December 3, 2006 + .Dt PKGFE 8 + .Os FreeBSD + .Sh NAME + .Nm pkgfe + .Nd Ncurses frontend for ports collection + .Sh SYNOPSIS + .Nm + .Cm command + .Op Ar ... + .Sh DESCRIPTION + The + .Nm + tool is used to install, upgrade or deinstall your ports and packages. + .Sh COMMANDS + The + .Cm command + can be any one of the following: + .Pp + .Bl -tag -width " " + .It "" + Show upgrade dialog + .It list + Update list of outdated packages, using "portversion -vl <" + .It cvs + Update ports tree using csup + .br + Run "portsdb -Fu" + .br + Run + .Nm + list + .It snap + Update ports tree using portsnap + .br + Run + .Nm + list + .It all + Run + .Nm + cvs + .br + Run + .Nm + .It snap+run + Run + .Nm + snap + .br + Run + .Nm + .It list+run + Run + .Nm + list + .br + Run + .Nm + .It fix + Run "pkgdb -F" + .It find [name|key] [regex] + Run "make search" in $PORTSDIR + .It c [port] + Run "make config" for port + .It findi [regex] + Search for packages and show install dialog + .It ls [regex] + Search packages in $PKG_DBDIR + .It noreq + Check for not required packages + .It deins + Deinstall package(s) by name + .It padb + Update portaudit database, using "portaudit -Fd" + .It i [port] + Run portinstall with $portupgrade_args + .It u [port] + Run portupgrade with $portupgrade_args + .It chkbin + Check for existence of required programs + .It showconf + Show configuration + .Sh FILES + .Bl -tag -width " " + .It $PREFIX/etc/pkgfe.conf + Default location of the pkgfe configuration file. + .Sh SEE ALSO + .Xr portupgrade 1 , + .Xr portaudit 1 , + .Xr portsnap 8 + .Sh AUTHOR + .An Sulev-Madis Silber Aq madis555 at hot dot ee