+# -C clear all phases
+# -n dry run
+# -a all phases
+# default is failed packages, orphaned elf, vacuum
+#
+# only affect files with the status in the list
+status=
+# phases
+# -cC remove command history by date
+remove_command_history=
+# -dD remove dry run
+remove_dry_run=1
+# -eE remove orphaned elf
+remove_orphaned_elf=1
+# -fF remove failed
+remove_failed=1
+# -hH fix file content hash
+remove_incomplete_packages=0
+fix_hash=0
+# -hH remove install history by date
+remove_history=
+# -lL remove old logs, given by date
+remove_logs=
+# -nN remove acked notes
+remove_acked_notes=0
+# -pP remove history for missing packages
+clean_missing_package_history=0
+
+# -hH remove all file content that is not scripts or configs
+remove_packagefile_content=1
+remove_script_content=1
+remove_config_content=1
+# -rR remove removed packages, unless preserved
+remove_removed_packages=0
+
+# -vV compactify the database file
+vacuum=0
+
+# remove orphaned rows in files table packagefiles, notes, scripts, ...
+unreferenced_file_content=1
+
+# remove outdated packages, unless preserved
+remove_old_packages=1
+
+db=${ZPMDB:-/var/lib/zpm/local.db}
+
+retain_old=${ZPM_KEEP_PACKAGES:-2}
+
+while getopts 'f:PcCk:' opt; do
+ case $opt in
+ f) db="$OPTARG" ;;
+ P) remove_old_packages=0 ;;
+ c) vacuum=1 ;;
+ C) unreferenced_file_content=0 ;;
+ k) retain_old="$OPTARG" ;;
+ esac
+done
+
+retain_old=$((retain_old + 0))
+if [ $retain_old -le 0 ]; then
+ retain_old=0
+fi