@ -14,11 +14,53 @@ then
exit 1
exit 1
fi
fi
PREFIX=""
target_env="$MSYSTEM"
cmd=""
if [ "$1" == "-t" ]
then
shift
target_env="${1^^}" #make uppercase
shift
case "$target_env" in
MSYS|msys|ALL|all)
PREFIX=""
;;
MINGW64|mingw64)
PREFIX="mingw-w64-x86_64-"
;;
UCRT64|ucrt64)
PREFIX="mingw-w64-ucrt-x86_64-"
;;
CLANG64|clang64)
PREFIX="mingw-w64-clang-x86_64-"
;;
MINGW64|mingw64)
PREFIX="mingw-w64-i686-"
;;
CLANG32|clang32)
PREFIX="mingw-w64-clang-i686-"
;;
CLANGARM64|clangarm64)
PREFIX="mingw-w64-clang-aarch64-"
;;
*)
echo "ERROR: Unknown environment '$target_env' given."
exit
;;
esac
else
if [ "$MSYSTEM" != "MSYS" ]
then
PREFIX="$MINGW_PACKAGE_PREFIX""-"
fi
fi
cmd="$1" # catch first arguments with $1
cmd="$1" # catch first arguments with $1
shift # drop the first argument from "$@"
shift # drop the first argument from "$@"
case "$cmd" in
case "$cmd" in
update)
update)
# Update local package repo/cache
# Update local package repo/cache
@ -38,13 +80,13 @@ case "$cmd" in
;;
;;
install|reinstall)
install|reinstall)
# (re)Install a package and its dependencies
# (re)Install a package and its dependencies
echo "Installing '$@' ..."
pacman -S "$@"
echo "Installing '$@' from '$target_env' ..."
pacman -S "$PREFIX$ @"
;;
;;
remove)
remove)
# Remove package - keep dependencies
# Remove package - keep dependencies
echo "Removing '$@' ..."
pacman -R "$@"
echo "Removing '$@' from '$target_env' ..."
pacman -R "$PREFIX$ @"
echo ""
echo ""
echo "If you want to remove unused dependencies, run 'aptman autoremove'"
echo "If you want to remove unused dependencies, run 'aptman autoremove'"
echo "or consider 'aptman purge [PKG]' next time."
echo "or consider 'aptman purge [PKG]' next time."
@ -56,8 +98,8 @@ case "$cmd" in
;;
;;
purge)
purge)
# Remove package, dependencies and all of the config files
# Remove package, dependencies and all of the config files
echo "Removing '$@', configurations and dependencies ..."
pacman -Rns "$@"
echo "Removing '$@', configurations and dependencies from '$target_env' ..."
pacman -Rns "$PREFIX$ @"
;;
;;
check)
check)
# Check & potentially fix broken dependencies
# Check & potentially fix broken dependencies
@ -66,13 +108,18 @@ case "$cmd" in
;;
;;
search)
search)
# Search for available packages
# Search for available packages
echo "Searching packages for '$@' ..."
pacman -Ss "$@"
echo "Searching packages for '$@' in '$target_env' ..."
if [ "$PREFIX" ]
then
pacman -Ss "$@" "$PREFIX"
else
pacman -Ss "$@"
fi
;;
;;
show)
show)
# Show info for a package
# Show info for a package
echo "Showing info for '$@' ..."
pacman -Si "$@"
echo "Showing info for '$PREFIX$ @' ..."
pacman -Si "$PREFIX$ @"
;;
;;
clean)
clean)
# Clean up pacman cache
# Clean up pacman cache