From 9ba9b0f9d093c4ed5ff74cc50b437dbf134ce476 Mon Sep 17 00:00:00 2001
From: Hinrikus Wolf <hinrikus@fsmpi.rwth-aachen.de>
Date: Thu, 21 Feb 2019 00:08:05 +0100
Subject: [PATCH] start with grml-zsh-config

---
 .../remove_non_zsh_config.patch               | 206 ++++++++++++++++++
 scripts/grml-zsh-config.sh                    |  35 +++
 2 files changed, 241 insertions(+)
 create mode 100644 patches/grml-zsh-config/remove_non_zsh_config.patch
 create mode 100755 scripts/grml-zsh-config.sh

diff --git a/patches/grml-zsh-config/remove_non_zsh_config.patch b/patches/grml-zsh-config/remove_non_zsh_config.patch
new file mode 100644
index 0000000..0111aa7
--- /dev/null
+++ b/patches/grml-zsh-config/remove_non_zsh_config.patch
@@ -0,0 +1,206 @@
+diff --git a/debian/control b/debian/control
+index f84c2fd..457ca53 100644
+--- a/debian/control
++++ b/debian/control
+@@ -1,4 +1,4 @@
+-Source: grml-etc-core
++Source: grml-zsh-config
+ Section: grml
+ Priority: optional
+ Maintainer: Michael Prokop <mika@grml.org>
+@@ -11,18 +11,11 @@ Vcs-Browser: https://git.grml.org/?p=grml-etc-core.git
+ Origin: Grml
+ Bugs: mailto:bugs@grml.org
+ 
+-Package: grml-etc-core
++Package: grml-zsh-config
+ Architecture: all
+ Conflicts: grml-autoconfig (<< 0.5-7),
+            grml-etc (<< 0.8-11),
+            grml-scripts (<< 0.8-27)
+-Replaces: vim-common
+-Depends: vim | nvi | editor
+-Recommends: grml-scripts-core
++Depends: sed, grep, coreutils
+ Pre-Depends: zsh
+-Description: core etcetera files for the Grml system
+- This package includes some /etc files for the
+- Grml system. Whereas the main grml-etc package is
+- meant for use on Grml systems this package can be
+- used on plain Debian (stable/testing/unstable)
+- systems as well.
++Description: Package ships grml's zsh configuration
+diff --git a/debian/dirs b/debian/dirs
+index 1197a6a..7c9906d 100644
+--- a/debian/dirs
++++ b/debian/dirs
+@@ -1,3 +1,2 @@
+ etc/skel
+ etc/zsh
+-usr/share
+diff --git a/debian/overrides b/debian/overrides
+index 3aed935..c4ff58b 100644
+--- a/debian/overrides
++++ b/debian/overrides
+@@ -1,3 +1,3 @@
+-grml-etc-core: unknown-section grml
+-grml-etc-core: diversion-for-unknown-file *&&[-f*.dpkg-bak]&&mv-f*.dpkg-bak* preinst:35
+-grml-etc-core: orphaned-diversion *&&[-f*.dpkg-bak]&&mv-f*.dpkg-bak* preinst
++grml-zsh-config: unknown-section grml
++grml-zsh-config: diversion-for-unknown-file *&&[-f*.dpkg-bak]&&mv-f*.dpkg-bak* preinst:35
++grml-zsh-config: orphaned-diversion *&&[-f*.dpkg-bak]&&mv-f*.dpkg-bak* preinst
+diff --git a/debian/postrm b/debian/postrm
+deleted file mode 100755
+index 72da544..0000000
+--- a/debian/postrm
++++ /dev/null
+@@ -1,44 +0,0 @@
+-#!/bin/sh
+-# Filename:      postrm
+-# Purpose:       postrm script for package grml-etc-core
+-# Authors:       grml-team (grml.org), (c) Michael Prokop <mika@grml.org>
+-# Bug-Reports:   see http://grml.org/bugs/
+-# License:       This file is licensed under the GPL v2.
+-################################################################################
+-
+-set -e
+-
+-TO_UNDIVERT1="zlogin zlogout zprofile zshenv zshrc"
+-TO_UNDIVERT2=".zshrc"
+-TO_UNDIVERT3="vimrc"
+-
+-undivert_gen() {
+-    if [ -f "$2/$1" -o "$2/$1".original ] ; then
+-        DEXT=${3:-original}
+-        dpkg-divert --remove --rename --package grml-etc-core \
+-            --divert $2/$1.$DEXT $2/$1 #> /dev/null
+-    fi
+-}
+-
+-case "$1" in
+-    purge)
+-        for cmd in $TO_UNDIVERT1; do
+-            undivert_gen $cmd /etc/zsh
+-        done
+-        for cmd in $TO_UNDIVERT2; do
+-            undivert_gen $cmd /etc/skel
+-        done
+-        for cmd in $TO_UNDIVERT3; do
+-            undivert_gen $cmd /etc/vim
+-        done
+-    ;;
+-    remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
+-    ;;
+-    *)
+-        echo "postrm called with unknown argument $1" >&2
+-        exit 1
+-esac
+-
+-exit 0
+-
+-## END OF FILE #################################################################
+diff --git a/debian/preinst b/debian/preinst
+deleted file mode 100755
+index c30e103..0000000
+--- a/debian/preinst
++++ /dev/null
+@@ -1,56 +0,0 @@
+-#!/bin/sh
+-# Filename:      preinst
+-# Purpose:       preinst script for package grml-etc-core
+-# Authors:       grml-team (grml.org), (c) Michael Prokop <mika@grml.org>
+-# Bug-Reports:   see http://grml.org/bugs/
+-# License:       This file is licensed under the GPL v2.
+-################################################################################
+-
+-set -e
+-
+-# check for files from rm_conffile() in debian/preinst of grml-etc
+-# make sure we don't lose any files...
+-backup_conffile() {
+-    CONFFILE="$1"
+-
+-    if [ -e "$CONFFILE.dpkg-bak" -a -e "$CONFFILE" ]; then
+-       cp -f "$CONFFILE" "$CONFFILE".original
+-    else
+-       [ -e "$CONFFILE" ] && cp -f "$CONFFILE" "$CONFFILE".grml-etc-core || true
+-    fi
+-}
+-
+-case "$1" in
+-    install|upgrade|configure)
+-        TMP=$$
+-        # move files from package grml-etc to grml-etc-core, make sure
+-        # we don't lose any files...
+-        for file in /etc/zsh/zlogin /etc/zsh/zprofile /etc/zsh/zshenv /etc/zsh/zshrc \
+-                    /etc/zsh/zlogout /etc/vim/vimrc /etc/tmux.conf; do
+-             [ -e "$file".original ] || cp -f "$file" "${file}.tmp.$TMP" 2>/dev/null || true
+-             backup_conffile $file && \
+-             [ -f "$file" ] && rm $file && \
+-             dpkg-divert --quiet --add --rename --package grml-etc-core --divert "$file".original $file  && \
+-             [ -f "$file".dpkg-bak ]      && mv -f "$file".dpkg-bak "$file"
+-             [ -f "$file".grml-etc-core ] && mv -f "$file".grml-etc-core "$file"
+-             [ -e "${file}.tmp.$TMP" ]      && mv -f "${file}.tmp.$TMP" "$file.original"
+-
+-             # trying to overwrite `/etc/skel/.zshrc', which is also in package zsh
+-             # [ -f /etc/skel/.zshrc ] && \
+-             # dpkg-divert --quiet --add --rename --package grml-etc-core --divert /etc/skel/.zshrc.original /etc/skel/.zshrc
+-        done
+-
+-        if dpkg-divert --list grml-etc-core 2>/dev/null | grep -q /etc/skel/.zshrc.original ; then
+-            mv -f /etc/skel/.zshrc.original /etc/skel/.zshrc.original.old && \
+-            dpkg-divert --remove --rename --package grml-etc-core /etc/skel/.zshrc
+-        fi
+-
+-    ;;
+-    *)
+-        echo "preinst called with unknown argument $1" >&2
+-        exit 1
+-esac
+-
+-exit 0
+-
+-## END OF FILE #################################################################
+diff --git a/debian/rules b/debian/rules
+index 7bf93ff..b49fc95 100755
+--- a/debian/rules
++++ b/debian/rules
+@@ -19,7 +19,7 @@ clean:
+ 	rm -f build-stamp
+ 
+ 	dh_clean 
+-	rm -rf debian/grml-etc-core/
++	rm -rf debian/grml-zsh-config/
+ 	(cd $(CURDIR)/doc && $(MAKE) clean)
+ 
+ install: build
+@@ -28,9 +28,9 @@ install: build
+ 	dh_clean -k 
+ 	dh_installdirs
+ 
+-	# Add here commands to install the package into debian/grml-etc-core.
+-	cp -a etc/ debian/grml-etc-core/
+-	cp -a usr_share_grml/ debian/grml-etc-core/usr/share/grml
++	# Add here commands to install the package into debian/grml-zsh-config.
++	cp -a etc/skel/.zshrc debian/grml-zsh-config/skel/
++	cp -a etc/zsh debian/grml-zsh-config/
+ 
+ # Build architecture-dependent files here.
+ binary-arch: build install
+@@ -45,12 +45,12 @@ binary-indep: build install
+ 	(cd $(CURDIR)/doc && $(MAKE) all)
+ 	dh_installman $(CURDIR)/doc/grmlzshrc.5
+ 	dh_compress
+-	mkdir -p debian/grml-etc-core/usr/share/lintian/overrides/
+-	cp -av debian/overrides debian/grml-etc-core/usr/share/lintian/overrides/grml-etc-core
++	mkdir -p debian/grml-zsh-config/usr/share/lintian/overrides/
++	cp -av debian/overrides debian/grml-zsh-config/usr/share/lintian/overrides/grml-zsh-config
+ 	dh_fixperms
+ 	dh_installdeb
+-	#find debian/grml-etc-core/etc -type f ! -name \*.xpm ! -name \*.png -print | \
+-	#sed -e 's#^debian/grml-etc-core##g' > debian/grml-etc-core/DEBIAN/conffiles
++	#find debian/grml-zsh-config/etc -type f ! -name \*.xpm ! -name \*.png -print | \
++	#sed -e 's#^debian/grml-zsh-config##g' > debian/grml-zsh-config/DEBIAN/conffiles
+ 	dh_shlibdeps
+ 	dh_gencontrol
+ 	dh_md5sums
diff --git a/scripts/grml-zsh-config.sh b/scripts/grml-zsh-config.sh
new file mode 100755
index 0000000..5b6feae
--- /dev/null
+++ b/scripts/grml-zsh-config.sh
@@ -0,0 +1,35 @@
+#!/bin/bash
+
+
+echo "deb-src http://deb.grml.org/ grml-stable main" > /etc/apt/sources.list.d/grml_src.list
+
+
+ADCLI_VERSION=$(rmadison adcli --architecture=amd64 -s stretch| cut -d\| -f2 | sed s"/ //g" | sed s"/\-.*$//g")
+
+
+
+apt-get update
+apt-get source --only-source adcli
+TARGET_DIR=adcli-$ADCLI_VERSION
+
+cd ${TARGET_DIR}/debian
+
+for patch in ../../patches/adcli/*.patch ; do
+    quilt import $patch
+done 
+
+cd ..
+
+debchange --preserve --newversion ${ADCLI_VERSION}-fsmpi "Apply the unreleased upstream-patches, fixing RT#100"
+
+apt-get build-dep -y adcli
+
+fakeroot debian/rules binary
+debuild -b -uc -us
+
+cd ..
+mkdir debug packages
+mv *dbgsym* debug
+mv *.deb packages
+
+
-- 
GitLab