Commit fd8b016e authored by Seblu's avatar Seblu
Browse files

base-seblu: move config file to its own package

parent e8f785e1
Loading
Loading
Loading
Loading
+3 −16
Original line number Diff line number Diff line
# Maintainer: Sébastien Luttringer <seblu@archlinux.org>

pkgname=base-seblu
pkgver=2013.09.11
pkgver=2013.09.25
pkgrel=1
pkgdesc='Provide depends on minimal seblu hosts packages'
arch=('any')
url='https://github.com/seblu/arch-packages'
license=('GPL2')
install=$pkgname.install
source=('git+ssh://seblu@seblu.net:2222/~/git/configs')
md5sums=('SKIP')

package() {
  depends=(
@@ -18,6 +16,7 @@ package() {
    bash
    bash-completion
    bridge-utils
    config-seblu
    conntrack-tools
    diffutils
    dmidecode
@@ -100,21 +99,9 @@ package() {
    sysvinit
    tcp_wrappers
  )
  install -dm755 "$pkgdir"/{usr/bin,etc/sysctl.d,usr/share/$pkgname}
  install -dm755 "$pkgdir/usr/bin"
  # perl-rename shortcut
  ln -s perl-rename "$pkgdir/usr/bin/prename"
  # disable default sysctl options provided by systemd
  ln -s /dev/null "$pkgdir/etc/sysctl.d/50-default.conf"
  # install defaults configs files
  cd "$srcdir/configs"
  _d="$pkgdir/usr/share/$pkgname"
  install -Dm644 systemd/{vconsole,locale}.conf "$_d"
  install -Dm644 systemd/sysctl.d/seblu.net.conf "$_d"
  install -Dm644 pam/{issue,motd} "$_d"
  install -Dm644 zsh/etc.zshrc "$_d"
  install -Dm644 e2fsprogs/e2fsk.conf "$_d"
  install -Dm644 ntp/ntp.conf "$_d"
  install -Dm644 vim/seblu.vim "$_d"
}

# vim:set ts=2 sw=2 et:
+4 −53
Original line number Diff line number Diff line
# vim:set ts=2 sw=2 et:

# $1: the file to update
check_file() {
  local p="/usr/share/base-seblu/${1##*/}"
  [[ -n "$2" ]] && p="/usr/share/base-seblu/$2"
  if [[ ! -e "$1" ]] || ! diff "$1" "$p" >/dev/null; then
    cp -f -v "$p" "$1"
  fi
}

# $1: the link target
# $2: the link himself
check_link() {
  _ct="$(readlink "$2")"
  if (( $? != 0 )) || [[ "$_ct" != "$1" ]]; then
    ln -vsnf "$1" "$2"
  fi
}

# arg 1:  the new package version
post_install() {
  check_file /etc/motd
  check_file /etc/issue
  check_file /etc/vconsole.conf
  check_file /etc/locale.conf
  check_file /etc/ntp.conf
  check_file /etc/e2fsk.conf
  check_file /etc/sysctl.d/seblu.net.conf
  check_file /etc/zsh/zshrc etc.zshrc

  # enable vim config
  check_file /usr/share/vim/vimfiles/seblu.vim
  if ! grep -q 'runtime! seblu.vim' /etc/vimrc; then
    echo '-- Updating /etc/vimrc'
    echo 'runtime! seblu.vim' >> /etc/vimrc
  fi

  # localtime
  check_link '/usr/share/zoneinfo/Europe/Paris' /etc/localtime

  # locales
  _md5="$(md5sum /etc/locale.gen)"
  sed -ri 's/#(en_US|fr_FR)/\1/' /etc/locale.gen
  [[ "$_md5" != "$(md5sum /etc/locale.gen)" ]] && locale-gen

  # check full hostname
  grep -q \. /etc/hostname || echo '!! /etc/hostname without FQDN'

  # sbin must be a symlink
  if [[ ! -L /usr/local/sbin ]]; then
    echo '!! /usr/local/sbin is not a symlink'
    rmdir '/usr/local/sbin' && ln -sn bin /usr/local/sbin
  fi

  # display depency info
  echo '-- Unused dependencies:'; pacman -Qdt
  echo '-- Local-only packages'; pacman -Qm
  echo '-- Unused dependencies:'
  pacman -Qdt
  echo '-- Local-only packages'
  pacman -Qm
  return 0
}