dotfiles/lib/crate.common.sh

44 lines
933 B
Bash
Raw Normal View History

2023-09-01 01:40:41 +02:00
#!/bin/sh
script() {
scripts_to_run="$scripts_to_run $1"
}
suscript() {
scripts_to_run_as_su="$scripts_to_run_as_su $1"
}
pkgs() {
for pkg in $@; do
pkgname="$(echo $pkg | cut -c 2-)"
case $(echo $pkg | cut -c 1) in
+)
packages_marked_for_install="$packages_marked_for_install $pkgname"
;;
-)
packages_marked_for_removal="$packages_marked_for_removal $pkgname"
;;
esac
done
}
conditionfn() {
conditionfns="$conditionfns $1"
}
descfile() {
islink=${ALWAYS_LINK:-0}
while getopts "l" opt; do
case $opt in
l)
islink=1
;;
esac
done
shift $((OPTIND-1))
if [ $islink -eq 1 ]; then
files_to_link="$files_to_link $(subvars $1):$(subvars $2)"
else
files_to_copy="$files_to_copy $(subvars $1):$(subvars $2)"
fi
}