Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 123 lines (100 sloc) 5.03 KB
# figtree; an Arch Linux AIF module to create conFIG TREEs from local or remote profiles
# Ethan Schoonover <>
# partial procedure: partial-package-diff
# load a profile (and any depend_profiles associated with it) and report
# which currently installed packages are not included in the profile
# installation. Useful to determine what may be mising from your AIF/figtree
# profile compared to your current system.
# Please see the for details and usage
# ----------------------------------------------------------------------
# procedure specific definitions
# ----------------------------------------------------------------------
depend_procedure figtree automatic
var_OPTS_STRING="c:u:" #var_OPTS_STRING="c:s:e:u:a:r:"
read -r -d '' var_ARGS_USAGE <<-'EOF'
Partial AIF procedure: figtree partial-package-diff
This procedure loads a figtree profile (and any depend_profiles associated with
it) and reports which *currently* installed packages are not included in the
profile installation. Useful to determine what may be mising from your AIF
figtree profile compared to your current system.
-c profile/path: Specify a profile path. While the full figtree aif
procedures can source and process remote or local
procedures, the figtree partial-package diff procedure
must operate on a local procedure as it also allows
updating. The path may specified in the following formats:
relative path: profiles/my-laptop
absolute path: ~/aif-files/figtree/profiles/my-laptop
the relative path will look for the "profiles" directory
(in this example) in the same module directory as the
figtree partial procedure, for example:
-u Adds missing packages to the end of the profile specified
using the -c command line argument as a single figtree
function (packages packagename [packagename]). While
convenient, it is best to subsequently place these packages
into more appropriate profiles or profile sections for the
sake of good organization.
# ----------------------------------------------------------------------
# procedure workers
# ----------------------------------------------------------------------
worker_intro ()
notify "\
AIF figtree partial procedure: update overlay files\n\
worker_configure ()
inform "Starting system configuration and profile load sequence..."
[ -z "$var_AUTOMATIC_PROFILE" ] && die_error "You must specify a config file to use this procedure"
# here we import our profile(s) to allow default values to be overridden
load_profile $var_AUTOMATIC_PROFILE || die_error "Failed to load profile $var_AUTOMATIC_PROFILE from paths $var_MODULE_PATHS"
inform "Overlay write started..."
# TODO: consider just moving/copying *all* files in overlay without any specification, or perhaps allow a special overlay value of "*"
# TODO: we might need to set certain permissions, but i'd rather leave this for the misc step
# i could also make the system_misc function or worker process an array of commands; here we use installs permissions arg
for overlay_file in $var_OVERLAY_FILES
# TODO: the following substitution performs differently in script vs command line;
# command line *requires* last slash to be escaped like this:
# from_path="${overlay_file/\/\//\/}"
# script *requires* last slash to *not* be escaped, so we use that here
# TODO: test if permissions are retained via --preserve-context
# TODO: confirm backups are created correctly
install -C -D -S ".figtree.old" --preserve-context -v -T "$from_path" "$to_path" \
|| die_error "failed to overlay file from \"$from_path\" to \"$to_path\""
process_args ()
while [[ -n $1 ]]
case $1 in
-c) [[ -n "$2" ]] && var_AUTOMATIC_PROFILE=$2 || die_error "You must specify an aif config profile when using the -c flag." ;;
-r) [[ -n "$2" ]] && var_REPO_TYPE=$2 || die_error "You must specify a repository type of git, hg, or svn with the -r flag." ;;
*) usage && exit 5 ;;
shift 2
Something went wrong with that request. Please try again.