summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--system/bash/APKBUILD116
-rw-r--r--system/bash/bash-noinfo.patch11
-rw-r--r--system/bash/bash.post-upgrade3
-rw-r--r--system/bash/bash.pre-deinstall3
-rw-r--r--system/bash/bash44-sensible-defaults.patch25
-rw-r--r--system/bash/bashrc71
6 files changed, 229 insertions, 0 deletions
diff --git a/system/bash/APKBUILD b/system/bash/APKBUILD
new file mode 100644
index 000000000..c5a476b1a
--- /dev/null
+++ b/system/bash/APKBUILD
@@ -0,0 +1,116 @@
+# Contributor: Łukasz Jendrysik <scadu@yandex.com>
+# Contributor: TBK <alpine@jjtc.eu>
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+pkgname=bash
+pkgver=4.4.12
+_patchlevel=${pkgver##*.}
+_myver=${pkgver%.*}
+_patchbase=${_myver/./}
+pkgrel=2
+pkgdesc="The GNU Bourne Again shell"
+url="http://www.gnu.org/software/bash/bash.html"
+arch="all"
+license="GPL3+"
+makedepends_build="bison flex"
+makedepends_host="readline-dev ncurses-dev"
+depends=""
+options="!checkroot"
+install="$pkgname.post-upgrade $pkgname.pre-deinstall"
+subpackages="$pkgname-doc $pkgname-binsh:binsh:noarch"
+source="http://ftp.gnu.org/gnu/bash/bash-${_myver}.tar.gz
+ bash-noinfo.patch
+ bash44-sensible-defaults.patch
+ bashrc
+ "
+# generate url's to patches. note: no forks allowed!
+_i=1
+_pad="00"
+while [ $_i -le $_patchlevel ]; do
+ [ $_i -ge 10 ] && _pad="0"
+ [ $_i -ge 100 ] && _pad=
+ source="$source http://ftp.gnu.org/gnu/bash/bash-$_myver-patches/bash$_patchbase-$_pad$_i"
+ _i=$(( $_i + 1))
+done
+
+# secfixes:
+# 4.4.12-r1:
+# - CVE-2016-0634
+
+builddir="$srcdir"/$pkgname-$_myver
+
+prepare() {
+ cd "$builddir"
+
+ # NOTE: This section is for applying the vendor patches, which are required to fix
+ # security holes. `default_prepare` does *not* apply vendor patches in the format
+ # shipped with bash. We also need to make sure vendor patches are applied before
+ # our own.
+ # If you disagree, please request an experimental rebuild with bash as /bin/sh,
+ # before removing this section.
+ for p in $source; do
+ case $p in
+ */bash[0-9][0-9]-[0-9]*)
+ msg "$p (vendor)"
+ patch -p0 -i "$srcdir"/${p##*/} || return 1
+ ;;
+ esac
+ done
+
+ default_prepare
+ update_config_sub
+}
+
+build() {
+ cd "$builddir"
+ ./configure \
+ --build=$CBUILD \
+ --host=$CHOST \
+ --prefix=/usr \
+ --bindir=/bin \
+ --mandir=/usr/share/man \
+ --infodir=/usr/share/info \
+ --with-curses \
+ --disable-nls \
+ --enable-readline \
+ --without-bash-malloc \
+ --with-installed-readline
+ # parallel build workarounds
+ make y.tab.c && make builtins/libbuiltins.a && make
+}
+
+check() {
+ cd "$builddir"
+ make check
+}
+
+package() {
+ cd ${startdir}/src/${pkgname}-${_myver}
+ make DESTDIR=${pkgdir} install
+
+ rm -rf "$pkgdir"/usr/share/locale
+ install -D -m755 "$srcdir"/bashrc "$pkgdir"/etc/bash/bashrc
+}
+
+binsh() {
+ pkgdesc="Use bash as /bin/sh"
+ provides="/bin/sh"
+ mkdir -p "$subpkgdir"/bin
+ ln -s /bin/bash "$subpkgdir"/bin/sh
+}
+
+sha512sums="73de3b425faaac55e45456b0f6f6d8077b5dfa7bb76e0d1894a19361b4a2b6bd4fbbe182117ddbfe9b07b4d898fba03537c261badc9533dd3c0da891764c7f29 bash-4.4.tar.gz
+9d8845491d0fe335bdd8e9a2bd98bda54bfed2ae3c35b2196c6d5a38bdf96c4d97572ba7d6b19ab605ef4e8f001f64cf3312f87dedebb9e37a95ad2c44e33cdb bash-noinfo.patch
+388433e9ab25948747adfa7c2b98021799d5d396e8771d09b5b079054380af3f299f78abef144fe93908f6eff252658137c95ebba9418fe385f0cecbb5795f24 bash44-sensible-defaults.patch
+2b6e2e34328f091cbe0882833eab99c6fddbe19a5942382c4c1fbe5b1d20158cfcfcaaaea1f941b9a481be0507b7ea55e6048f79246657019713f0b201318e45 bashrc
+fa7a1b277eb3bad6ae7d2c7a2887cbf2c0eb75b7fee8ed03ec1e9d45879a2fb4b8c7cb16d6b029987493b01a461214bd9a24454a6837e7cfe180b1bc56f61caa bash44-001
+526f986057810f89080e283ff95b3a8fd24d37e4ad2f18c39f36d3a2d57956a6441d16220082157735e3c5ccf770d5016e761aa5f309129898e39277d576e6b5 bash44-002
+e61db89bdd1a7ae15013fe258046a343c9ea41e5a1c6d2c810947500a617fce7536b8d51194e14bb42499fe0de6d70cc9b2c81da0afdcb5a2278459f4f76d748 bash44-003
+7570cf15518f79230cfe91b3e58c795c16c7fb6ba6418d967355b36fb7982e7919a9eaaef9177fb605c7fb7d7efb8a8335e725c1bacffff69a098433f5adc9c7 bash44-004
+7546a6c90c8e8508567dde713722291477ca87c1116905b46432514a4fc632840a855b84f102591914cd4c44d5bf2eb7400866e26366fc94525fb401ea844a8f bash44-005
+5edcd76cf97bfe289f71924ba279ff48a1167eb3cc36f811cbcc23732746f5c821d1d39d4b137b7d99d57809a4b7270a54f4a41176fcfde0708bf92ddc68b77f bash44-006
+386c019debee414697abc648d9a77894e842bb0b7a2a71709e8b3398582f25065e68963405fa22fb77439c6b431ee94a2ecbb16734c2436af3dfb4d1b5f06fcf bash44-007
+d9a8924f1c9263deab89153bb688a87f211913ebd72c8077e607db6fdddc7e5af05042dd22a9a2df593e518ea74b54ca79d20afc796e47d871827a2556e233d0 bash44-008
+3b01c080cf4a54658679b36c282a69a9ac48b900b19ceb42dbaf084abd395d50e5ff14db90a7fdf0c9856dad150897dca561160686c931634765782447fc076e bash44-009
+54ff556b62fd88381e7a495db50957b016474973b3a566661c65b649a40960f2d3355221b3a71fb292128aad92a45d73d9816d63833bc416b4d15acdef391b98 bash44-010
+6b5b068b74978fc691749ccff5e094c768047f702430e97114f5bf342f078696f7d7616d0642d4061b062e9112dfe00a1c2309c65de4147e0e98fb52c593d844 bash44-011
+4661c4c132f2ea7c9a70368301041c482d5820d8389334a7e3ae44c36fc16c171b20db2f194b7663c84d6c3dcef81aa90f050a48e205218fc7bd3395d09c6a51 bash44-012"
diff --git a/system/bash/bash-noinfo.patch b/system/bash/bash-noinfo.patch
new file mode 100644
index 000000000..bf4f0956a
--- /dev/null
+++ b/system/bash/bash-noinfo.patch
@@ -0,0 +1,11 @@
+--- a/doc/Makefile.in
++++ b/doc/Makefile.in
+@@ -247,7 +247,7 @@
+ $(SHELL) $(SUPPORT_SRCDIR)/mkinstalldirs $(DESTDIR)$(htmldir) ; \
+ fi
+
+-install: info installdirs
++install: installdirs
+ -$(INSTALL_DATA) $(srcdir)/bash.1 $(DESTDIR)$(man1dir)/bash${man1ext}
+ -$(INSTALL_DATA) $(srcdir)/bashbug.1 $(DESTDIR)$(man1dir)/bashbug${man1ext}
+ -$(INSTALL_DATA) $(OTHER_DOCS) $(DESTDIR)$(docdir)
diff --git a/system/bash/bash.post-upgrade b/system/bash/bash.post-upgrade
new file mode 100644
index 000000000..92ea8d928
--- /dev/null
+++ b/system/bash/bash.post-upgrade
@@ -0,0 +1,3 @@
+#!/bin/sh
+add-shell '/bin/bash'
+exit 0
diff --git a/system/bash/bash.pre-deinstall b/system/bash/bash.pre-deinstall
new file mode 100644
index 000000000..d110afedd
--- /dev/null
+++ b/system/bash/bash.pre-deinstall
@@ -0,0 +1,3 @@
+#!/bin/sh
+remove-shell '/bin/bash'
+exit 0
diff --git a/system/bash/bash44-sensible-defaults.patch b/system/bash/bash44-sensible-defaults.patch
new file mode 100644
index 000000000..4d11afd2d
--- /dev/null
+++ b/system/bash/bash44-sensible-defaults.patch
@@ -0,0 +1,25 @@
+diff -Naur bash-4.4/config-top.h bash-4.4-adelieconf/config-top.h
+--- bash-4.4/config-top.h 2016-05-19 18:34:02.000000000 +0000
++++ bash-4.4-adelieconf/config-top.h 2018-02-06 01:07:33.736749439 +0000
+@@ -87,10 +87,10 @@
+ #define DEFAULT_BASHRC "~/.bashrc"
+
+ /* System-wide .bashrc file for interactive shells. */
+-/* #define SYS_BASHRC "/etc/bash.bashrc" */
++#define SYS_BASHRC "/etc/bash/bashrc"
+
+ /* System-wide .bash_logout for login shells. */
+-/* #define SYS_BASH_LOGOUT "/etc/bash.bash_logout" */
++#define SYS_BASH_LOGOUT "/etc/bash/bash_logout"
+
+ /* Define this to make non-interactive shells begun with argv[0][0] == '-'
+ run the startup files when not in posix mode. */
+@@ -100,7 +100,7 @@
+ sshd and source the .bashrc if so (like the rshd behavior). This checks
+ for the presence of SSH_CLIENT or SSH2_CLIENT in the initial environment,
+ which can be fooled under certain not-uncommon circumstances. */
+-/* #define SSH_SOURCE_BASHRC */
++#define SSH_SOURCE_BASHRC
+
+ /* Define if you want the case-capitalizing operators (~[~]) and the
+ `capcase' variable attribute (declare -c). */
diff --git a/system/bash/bashrc b/system/bash/bashrc
new file mode 100644
index 000000000..c4ae18bb9
--- /dev/null
+++ b/system/bash/bashrc
@@ -0,0 +1,71 @@
+# Welcome to Adélie Linux
+# /etc/bash/bashrc - run by bash on every startup
+
+# Prior to 1.0a3, we did a lot of heavy lifting here.
+# Massive cleanup for 1.0a3 makes things faster and more efficient.
+
+# No interactivity = no point
+if [[ $- != *i* ]]; then
+ return
+fi
+
+# Extra stat(3) call to invalidate hash cache. Better UX, but lots of waste.
+# shopt -s checkhash
+
+# Handle window resizing after a curses program quits
+shopt -s checkwinsize
+
+# Append instead of overwriting histfile.
+shopt -s histappend
+
+# Allow users to correct typos in history substs.
+shopt -s histreedit
+
+# Save commands as they were typed.
+shopt -s lithist
+
+# Don't show every command available if a user types \t on a bare line
+shopt -s no_empty_cmd_completion
+
+# Expand things like \n \r \t when using built-in echo(1).
+shopt -s xpg_echo
+
+
+do_colour() {
+ local colourise=false
+ LS_COLORS=
+ eval "$(dircolors -b)"
+ if [[ -n ${LS_COLORS:+set} ]]; then
+ colourise=true
+ else
+ unset LS_COLORS
+ fi
+
+ if ${colourise} ; then
+ if [[ ${EUID} == 0 ]] ; then
+ PS1='\[\e[01m\]\h\[\e[22m\] \[\e[01;36m\]\w\[\e[00m\] \[\e[01;31m\]\$\[\e[00m\] '
+ else
+ PS1='\u on \[\e[01m\]\h\[\e[22m\] \w \[\e[01;32m\$\[\e[00m\] '
+ fi
+
+ alias ls='ls --color=auto'
+ alias grep='grep --colour=auto'
+ alias egrep='egrep --colour=auto'
+ alias fgrep='fgrep --colour=auto'
+ else
+ if [[ ${EUID} == 0 ]] ; then
+ # show root@ when we don't have colors
+ PS1='! \u on \h \w \$ '
+ else
+ PS1='\u on \h \w \$ '
+ fi
+ fi
+}
+
+do_colour
+
+for sh in /etc/bash/bashrc.d/* ; do
+ [[ -r ${sh} ]] && source "${sh}"
+done
+
+unset do_colour