Skip to content

Commit

Permalink
dev
Browse files Browse the repository at this point in the history
  • Loading branch information
taiki-e committed Jan 18, 2025
1 parent 6f0e21f commit 5523f6c
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 26 deletions.
61 changes: 36 additions & 25 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,34 +10,45 @@ runs:
- run: |
set -eu
if ! command -v bash >/dev/null; then
install=''
if grep -Eq '^ID=alpine' /etc/os-release; then
printf '::group::Install packages required for checkout-action (bash)\n'
# NB: sync with apk_install in main.sh
if command -v sudo >/dev/null; then
sudo apk --no-cache add bash
elif command -v doas >/dev/null; then
doas apk --no-cache add bash
else
apk --no-cache add bash
fi
printf '::endgroup::\n'
install='apk'
elif grep -Eq '^ID_LIKE=.*openwrt' /etc/os-release; then
printf '::group::Install packages required for checkout-action (bash)\n'
# NB: sync with opkg_install in main.sh
if command -v sudo >/dev/null; then
sudo mkdir -p /var/lock
sudo opkg update
sudo opkg install bash
else
mkdir -p /var/lock
opkg update
opkg install bash
fi
printf '::endgroup::\n'
else
printf '::error::checkout-action requires bash\n'
exit 1
# https://github.com/openwrt/openwrt/issues/16935
install='apk'
fi
case "${install}" in
apk)
printf '::group::Install packages required for checkout-action (bash)\n'
# NB: sync with apk_install in main.sh
if command -v sudo >/dev/null; then
sudo apk --no-cache add bash
elif command -v doas >/dev/null; then
doas apk --no-cache add bash
else
apk --no-cache add bash
fi
printf '::endgroup::\n'
;;
opkg)
printf '::group::Install packages required for checkout-action (bash)\n'
# NB: sync with opkg_install in main.sh
if command -v sudo >/dev/null; then
sudo mkdir -p /var/lock
sudo opkg update
sudo opkg install bash
else
mkdir -p /var/lock
opkg update
opkg install bash
fi
printf '::endgroup::\n'
;;
*)
printf '::error::checkout-action requires bash\n'
exit 1
;;
esac
fi
bash --noprofile --norc "${GITHUB_ACTION_PATH:?}/main.sh"
shell: sh
Expand Down
8 changes: 7 additions & 1 deletion main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,13 @@ sys_install() {
suse) zypper_install "$@" ;;
arch) pacman_install "$@" ;;
alpine) apk_install "$@" ;;
openwrt) opkg_install "$@" ;;
openwrt)
# if type -P apk >/dev/null; then
apk_install "$@"
# else
# opkg_install "$@"
# fi
;;
esac
}

Expand Down

0 comments on commit 5523f6c

Please sign in to comment.