summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorClaudia2017-05-06 23:26:29 +0200
committerClaudia Pellegrino2017-06-18 16:39:37 +0200
commitdec579816e95dd367923ee44e3cfcc601679ec02 (patch)
tree7eddf20d6c9d7ee747fb27ec34802cc46115ead6
parentadeb5bb5fadffac86b0ff276257e1bff76754969 (diff)
downloadaur-dec579816e95dd367923ee44e3cfcc601679ec02.tar.gz
Add post-install script
-rw-r--r--PKGBUILD18
-rw-r--r--bash-it-git.install6
-rwxr-xr-xinstall-bash-it16
3 files changed, 30 insertions, 10 deletions
diff --git a/PKGBUILD b/PKGBUILD
index de055d053030..b24388e89d58 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -10,7 +10,7 @@ pkgdesc='A community Bash framework'
arch=('any')
url='https://github.com/Bash-it/bash-it'
license=('custom:undecided')
-depends=('bash' 'curl' 'p7zip')
+depends=('bash' 'coreutils' 'curl' 'p7zip')
optdepends=(
'autojump: plugin'
'base-devel: `makefile` completion'
@@ -34,11 +34,13 @@ source=(
'https://github.com/Bash-it/bash-it/tarball/master'
'LICENSE'
'custom.bash'
+ 'install-bash-it'
)
sha512sums=(
'SKIP'
'SKIP'
'SKIP'
+ 'SKIP'
)
noextract=("${pkgname}.tar.gz")
@@ -57,6 +59,7 @@ prepare() {
package() {
# All upstream-provided files go into the /usr hierarchy
+ mkdir -p "${pkgdir}/usr/bin"
mkdir -p "${pkgdir}/usr/lib/${pkgname}"
mkdir -p "${pkgdir}/usr/share/${pkgname}"
mkdir -p "${pkgdir}/usr/share/doc/${pkgname}"
@@ -66,6 +69,10 @@ package() {
"${pkgdir}/usr/share/licenses/${pkgname}" \
"${srcdir}/LICENSE"
+ cp --preserve=mode -t \
+ "${pkgdir}/usr/bin" \
+ "${srcdir}/install-bash-it"
+
cp -r --preserve=mode -t "${pkgdir}/usr/lib/${pkgname}" \
"${srcdir}"/{bash_it,install,uninstall}.sh \
"${srcdir}"/{aliases,completion,custom,lib} \
@@ -135,17 +142,14 @@ package() {
# Create symlink to `custom/example.bash`
ln -fs \
- "${pkgdir}/usr/lib/${pkgname}/custom/example.bash" \
+ "/usr/lib/${pkgname}/custom/example.bash" \
"${_factorydir}/custom/"
# Create symlinks to remaining files
ln -fs \
"/usr/lib/${pkgname}"/{bash_it,install,uninstall}.sh \
- "/usr/lib/${pkgname}"/{lib,template,themes} \
- "/usr/share/${pkgname}"/.editorconfig \
+ "/usr/lib/${pkgname}"/{lib,themes} \
+ "/usr/share/${pkgname}"/{.editorconfig,template} \
"/usr/share/doc/${pkgname}"/{CONTRIBUTING,README}.md \
"${_factorydir}/"
-
- # The user who installed the package gets a copy on the house
- cp -r --preserve=mode -t ~/ "${_factorydir}"
}
diff --git a/bash-it-git.install b/bash-it-git.install
index 39534b910205..4fea1890ccb7 100644
--- a/bash-it-git.install
+++ b/bash-it-git.install
@@ -1,9 +1,9 @@
post_install() {
- msg2 'Note: To enable bash-it, run: ~/.bash_it/install.sh'
- ~/.bash_it/install.sh --help >&2
+ echo >&2 'Note: To install bash-it for the logged-in user,' \
+ 'run: install-bash-it'
}
post_remove() {
- msg2 'Note: To complete removal, restore your' \
+ echo >&2 'Note: To complete removal, restore your' \
'original `~/.bashrc` file from `~/.bashrc.bak`.'
}
diff --git a/install-bash-it b/install-bash-it
new file mode 100755
index 000000000000..5a59dc2d16aa
--- /dev/null
+++ b/install-bash-it
@@ -0,0 +1,16 @@
+#!/bin/sh
+set -e
+
+if [[ "$(whoami)" != "$(logname)" ]]; then
+ echo >&2 'This command will install files into your' \
+ 'home directory. It must be run without sudo.'
+ exit 1
+fi
+
+echo >&2 'Installing files into ~/.bash_it'
+
+cp -irvP --preserve=mode,links -t ~/ \
+ "/usr/share/bash-it-git/home_factory/.bash_it"
+
+echo >&2 'To complete the installation, run: ~/.bash_it/install.sh'
+~/.bash_it/install.sh --help >&2