Skip to content

Commit

Permalink
remove archpkg operation
Browse files Browse the repository at this point in the history
Signed-off-by: Tin Lai <[email protected]>
  • Loading branch information
soraxas committed Sep 1, 2023
1 parent f614199 commit 2a13f26
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 56 deletions.
1 change: 0 additions & 1 deletion completions/shsh.fish
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ complete -f -c shsh -n "__fish_shsh_using_command install" -l noconfirm -d "do n
complete -f -c shsh -n "__fish_shsh_using_command install" -l ssh -d "use ssh protocal instead of https"
complete -f -c shsh -n "__fish_shsh_using_command install" -l plain -d "build a plain package from the ground up"
complete -f -c shsh -n "__fish_shsh_using_command install" -l gh-release -d "download binary from github release assets"
complete -f -c shsh -n "__fish_shsh_using_command install" -l archpkg -d "install the package as an Arch/AUR package"

complete -f -c shsh -n "__fish_shsh_using_command uninstall" -l quiet -d "be quiet even if package does not exists"
complete -f -c shsh -n "__fish_shsh_using_command uninstall" -l use-rc -d "uninstall all packages not present in SHSHRC"
Expand Down
4 changes: 1 addition & 3 deletions libexec/shsh-_env-var
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,11 @@ export SHSH_PREFIX="${SHSH_PREFIX:=$SHSH_ROOT/cellar}"
export SHSH_PACKAGES_PATH="${SHSH_PACKAGES_PATH:=$SHSH_PREFIX/packages}"
export SHSH_INSTALL_BIN="${SHSH_INSTALL_BIN:=$SHSH_PREFIX/bin}"
export SHSH_INSTALL_MAN="${SHSH_INSTALL_MAN:=$SHSH_PREFIX/man}"
export SHSH_INSTALL_ARCHPKG_ROOT="${SHSH_INSTALL_ARCHPKG_ROOT:=$SHSH_ROOT/cellar/archpkg_root}"
_xdg_config_home="${XDG_CONFIG_HOME:=$HOME/.config}"
export SHSHRC="${SHSHRC:=$_xdg_config_home/shshrc}"

bin_path="$(dirname "$(resolve_link "$0")")"
export PATH="${bin_path}:${PATH}"
export UTILS_FUNC="$bin_path/shsh-_utils"

export SHSH_JUNEST_ROOT="$SHSH_ROOT/cellar/arch_junest_root"
export SHSH_JUNEST_BIN="$SHSH_JUNEST_ROOT/junest_bin"
export SHSH_JUNEST_BIN="$SHSH_JUNEST_ROOT/junest_bin"
25 changes: 1 addition & 24 deletions libexec/shsh-_utils
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ parse_install_folder() {
# if a second argunment is given (and non-empty),
# if will be perform error check
unset _folder_namespace _folder_target _folder_full
operation="$2"
# operation="$2"
# error_check="$2"
if [ -z "$1" ]; then
# if [ -n "$error_check" ]; then
Expand Down Expand Up @@ -340,14 +340,9 @@ EOF
# fi
_folder_namespace="$1"
_folder_target="$1"
[ "$operation" = "archpkg" ] && _folder_namespace="_archpkg"
info_echo "> Going to use '$_folder_namespace/$_folder_target' as the install folder"
;;
esac
if [ -n "$operation" ] && [ "$operation" != "archpkg" ] && [ "$_folder_namespace" = "_archpkg" ]; then
error_echo "> The '_archpkg' namespace is reserved and cannot be used."
exit 1
fi
_folder_full="$_folder_namespace/$_folder_target"
export _folder_namespace
export _folder_target
Expand Down Expand Up @@ -401,24 +396,6 @@ if ! command_exists jq; then
}
fi

get_archlinux_makepkg() {
_makepkg_path="$(shsh package-path _bootstrap/archmakepkg)" || true

if [ -z "$_makepkg_path" ]; then
# bootstrap custom makepkg
info_echo "> Installing custom arch makepkg"

# no linking
shsh install soraxas/archlinux-makepkg-stripped _bootstrap/archmakepkg -v BINS='' >/dev/null 2>&1
_makepkg_path="$(shsh package-path _bootstrap/archmakepkg)" || true
if [ -z "$_makepkg_path" ]; then
error_echo "> error in bootstrapping makepkg"
exit 1
fi
fi
echo "$_makepkg_path/makepkg"
}

parse_hooks_and_setvar() {
echo_if_verbose ">> parsing install command: '$*'"
# shellcheck disable=SC2116,SC2028
Expand Down
27 changes: 2 additions & 25 deletions libexec/shsh-install
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
# flag implies --plain
# TODO: currently it is bias towards linux and amd64;
# to-be generalised towards detecting current arch.
# --arch[pkg] install the <package> as Arch package (or AUR)
# -f, --force force the installation even if the package exists
# --ssh use ssh protocal instead of https
#
Expand Down Expand Up @@ -90,17 +89,10 @@ if [ "$#" != 0 ]; then
--ssh)
use_ssh="true"
;;
--arch|--archpkg)
archpkg="true"
;;
--nocleanup)
no_cleanup="true"
export no_cleanup
;;
--noconfirm)
SHSH_ARCHPKG_NOCONFIRM="true"
export SHSH_ARCHPKG_NOCONFIRM
;;
-f|--force)
force_install="true"
;;
Expand Down Expand Up @@ -146,27 +138,20 @@ fi

############################################################

if [ -n "$2" ] && [ -n "$archpkg" ]; then
error_echo "> Arch/AUR package cannot use custom folder name."
exit 1
fi

# custom folder name
parse_install_folder "$2" "$operation" && package="$_folder_full"


##########################################
if [ -n "$plain_package" ]; then
operation="plain"
elif [ -n "$archpkg" ]; then
operation="archpkg"
else
operation="gitclone"
fi

case "$operation" in
#########
plain|archpkg)
plain)
if [ -z "$package" ]; then
# extract ref if it exists
ref=""
Expand Down Expand Up @@ -255,10 +240,6 @@ case "$operation" in
# plain package or github-release
mkdir -p "${SHSH_PACKAGES_PATH}/$package"
;;
archpkg)
mkdir -p "${SHSH_PACKAGES_PATH}/$package"
shsh-_install-archpkg "$1" "$package"
;;
gitclone)
# only perform link if clone is successful (and package not exists before)
if ! shsh-_clone "$use_ssh" "$site" "$gitrepo" "$ref" "$package"; then
Expand All @@ -284,11 +265,7 @@ fi
# add successfully installed package to shshrc
if [ -e "$SHSHRC" ]; then
set +e # allow non-zero exit status in pattern matching
if [ "$operation" = "archpkg" ]; then
_target_package="$1"
else
_target_package="$package"
fi
_target_package="$package"
shshrc_get_existing_install_cmd "$_target_package"
new_statement="shsh install $original_args"

Expand Down
2 changes: 0 additions & 2 deletions libexec/shsh-list
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ for package_path in "${SHSH_PACKAGES_PATH}"/*/*; do
else
extra_info="gh-release: unknown (missing jq)"
fi
elif [ "$username" = "_archpkg" ]; then
extra_info="Arch-package: $package"
else
# is a plain package
extra_info="plain package"
Expand Down
1 change: 0 additions & 1 deletion libexec/shsh-uninstall
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ fi
shsh-_unlink-man "$package"
shsh-_unlink-bins "$package"
shsh-_unlink-completions "$package"
shsh-_unlink-archpkg "$package"
[ -n "$SHSH_HOOK_UNINSTALL" ] && execute_hooks "uninstall-hook" "$SHSH_PACKAGES_PATH/$package" "$SHSH_HOOK_UNINSTALL"

rm -rf "${SHSH_PACKAGES_PATH:?}/$package"

0 comments on commit 2a13f26

Please sign in to comment.