app-shells/oh-my-bash: new package, add 9999

This commit is contained in:
blackteahamburger 2024-08-22 18:40:33 +08:00 committed by 梁永祥
parent 8a16e7cc20
commit 6a84cc5bda
3 changed files with 76 additions and 0 deletions

View File

@ -0,0 +1,35 @@
--- a/tools/upgrade.sh
+++ b/tools/upgrade.sh
@@ -25,18 +25,22 @@
printf '%s\n' "${BLUE}Updating Oh My Bash${NORMAL}"
- # Note: The git option "-C PATH" is only supported from git-1.8.5
- # (https://github.com/git/git/commit/44e1e4d6 2013-09). On the other hand,
- # the synonym "--git-dir=PATH/.git --work-tree=PATH" is supported from
- # git-1.5.3 (https://github.com/git/git/commit/892c41b9 2007-06).
- if ! command git --git-dir="$OSH/.git" --work-tree="$OSH" pull --rebase --stat origin master; then
- # In case it enters the rebasing mode
- printf '%s\n' "oh-my-bash: running 'git rebase --abort'..."
- command git --git-dir="$OSH/.git" --work-tree="$OSH" rebase --abort
+ # Switch for the use of "sudo"
+ local _omb_tmp_sudo=
+ if [[ ${OMB_UPGRADE_SUDO+set} ]]; then
+ _omb_tmp_sudo=${OMB_UPGRADE_SUDO:+OMB_UPGRADE_SUDO }
+ elif [[ ${OMB_USE_SUDO-true} == true ]]; then
+ if ((EUID != 0)) && _omb_util_binary_exists sudo; then
+ _omb_tmp_sudo='sudo '
+ fi
+ fi
+
+ if _omb_util_binary_exists smart-live-rebuild; then
+ ${_omb_tmp_sudo} smart-live-rebuild -f app-shells/oh-my-bash || return 1
+ else
printf "${RED}%s${NORMAL}\n" \
'There was an error updating.' \
- "If you have uncommited changes in '$BOLD$OSH$NORMAL$RED', please commit, stash or discard them and retry updating." \
- "If you have your own local commits in '$BOLD$OSH$NORMAL$RED' that conflict with the upstream changes, please resolve conflicts and merge the upstream manually."
+ "Please install app-portage/smart-live-rebuild and retry updating."
return 1
fi

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="person">
<name>blackteahamburger</name>
<email>blackteahamburger@outlook.com</email>
</maintainer>
<upstream>
<remote-id type="github">ohmybash/oh-my-bash</remote-id>
</upstream>
</pkgmetadata>

View File

@ -0,0 +1,30 @@
# Copyright 2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit git-r3
DESCRIPTION="An open source, community-driven framework for managing your bash configuration"
HOMEPAGE="https://ohmybash.github.io"
EGIT_REPO_URI="https://github.com/ohmybash/oh-my-bash.git"
LICENSE="MIT"
SLOT="0"
PATCHES=( "${FILESDIR}/${P}-custom-upgrade.patch" )
src_prepare() {
sed -i -e 's|~/.oh-my-bash|/usr/share/oh-my-bash|' templates/bashrc.osh-template || die
default
}
src_install() {
insinto /usr/share/oh-my-bash
doins -r *
}
pkg_postinst() {
elog "In order to use oh-my-bash, copy /usr/share/oh-my-bash/templates/bashrc.osh-template over to your ~/.bashrc"
}