Minor changes.
This commit is contained in:
parent
bd5b513a69
commit
c97a391d87
|
|
@ -1,8 +1,11 @@
|
|||
#!/usr/bin/env bash
|
||||
# openrc uses sysvinit but from 0.2.5 can replace it. ascii version currently 0.2.3
|
||||
apt install -y sysvinit-core
|
||||
apt install -y util-linux sysvinit-utils
|
||||
apt install -y util-linux sysvinit-utils
|
||||
apt install -y initscripts openrc
|
||||
|
||||
# Reboot when done
|
||||
for file in /etc/rc0.d/K*; do s=`basename $(readlink "$file")` ; /etc/init.d/$s stop; done
|
||||
for file in /etc/rc0.d/K*; do
|
||||
s=$(basename $(readlink "$file"))
|
||||
/etc/init.d/$s stop
|
||||
done
|
||||
|
|
|
|||
10
020_grc.sh
10
020_grc.sh
|
|
@ -1,18 +1,18 @@
|
|||
#!/usr/bin/env bash
|
||||
sudo apt install -y grc
|
||||
sudo apt install -y grc bat
|
||||
|
||||
DEST=${1:-/etc/skel}
|
||||
ALIAS_DIR=".zsh_aliases.d"
|
||||
ALIAS_HOME=${DEST}/${ALIAS_DIR}/
|
||||
ALIAS_HOME=${DEST}/${ALIAS_DIR}
|
||||
ALIAS_FILE=${ALIAS_HOME}/003_grc.sh
|
||||
|
||||
mkdir -p ${ALIAS_HOME}
|
||||
mkdir -p "${ALIAS_HOME}"
|
||||
|
||||
cat > ${ALIAS_FILE} <<'EOF'
|
||||
cat >"${ALIAS_FILE}" <<'EOF'
|
||||
# coloured output using grc
|
||||
if [ -e /usr/bin/grc ]; then
|
||||
alias cl="/usr/bin/grc -es --colour=auto"
|
||||
alias cat="cl cat"
|
||||
alias cat="bat -p"
|
||||
alias ping="cl ping"
|
||||
alias netstat="cl netstat"
|
||||
alias traceroute="cl traceroute"
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
#!/usr/bin/env bash
|
||||
## PREREQUISITES:
|
||||
## 1. zfs-auto-snapshot or equivalent package installed locally and regular
|
||||
## 1. zfs-auto-snapshot or equivalent package installed locally and regular
|
||||
## snapshots enabled (hourly, daily, etc.)
|
||||
# NB now available in ascii with:
|
||||
# apt install -y zfs-auto-snapshot
|
||||
# or:
|
||||
## Make ZFS Snapshots work on Debian
|
||||
## A .deb package can be created for zfs-auto-snapshot:
|
||||
apt install -y git build-essential zfsnap
|
||||
apt install -y git build-essential
|
||||
apt install -y zfs-auto-snapshot
|
||||
#ZSH_BUILD_HOME=/var/tmp/zfs-auto-snapshot
|
||||
#mkdir -p ${ZSH_BUILD_HOME} && \
|
||||
|
|
@ -23,10 +23,10 @@ sed -i 's|-q|--quiet|g' /etc/cron.d/zfs-auto-snapshot
|
|||
sed -i 's|-g|--syslog|g' /etc/cron.d/zfs-auto-snapshot
|
||||
|
||||
for i in $(find /etc/cron.*/zfs-auto-snapshot); do
|
||||
sed -i 's|--quiet|--quiet --fast|g' "${i}"
|
||||
sed -i 's|--quiet|--quiet --fast|g' "${i}"
|
||||
done
|
||||
|
||||
## 2. home directory set for zfssnap role (the user taking snapshots and
|
||||
## 2. home directory set for zfssnap role (the user taking snapshots and
|
||||
## doing the sending):
|
||||
# rolemod -d /path/to/home zfssnap
|
||||
## 3. ssh keys set up between zfssnap@localhost and remuser@remhost:
|
||||
|
|
@ -39,10 +39,10 @@ done
|
|||
## This can be done on a top-level filesystem, and is inherited by default.
|
||||
## Depending on your usage, you may need to also allow further permissions such
|
||||
## as share, sharenfs, hold, etc.
|
||||
## 5. an initial (full) zfs send/receive done so that remhost has the fs we
|
||||
## 5. an initial (full) zfs send/receive done so that remhost has the fs we
|
||||
## are backing up, and the associated snapshots -- something like:
|
||||
# zfs send -R $POOL/$FS@zfs-auto-snap_daily-(latest) | ssh $REMUSER@$REMHOST zfs recv -dvF $REMPOOL
|
||||
## Note: 'zfs send -R' will send *all* snapshots associated with a dataset, so
|
||||
## Note: 'zfs send -R' will send *all* snapshots associated with a dataset, so
|
||||
## if you wish to purge old snapshots, do that first.
|
||||
## 6. zfs allow any additional permissions needed, to fix any errors produced in
|
||||
## step 5
|
||||
|
|
|
|||
|
|
@ -1,120 +1,78 @@
|
|||
#/usr/bin/env bash
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
ARCH=$(dpkg --print-architecture)
|
||||
if [[ ${ARCH} == "armhf" ]]; then ARCH="arm-v7"; fi
|
||||
# Config
|
||||
USER="zunit-zsh"
|
||||
PROJECT="zunit"
|
||||
PACKAGE="zsh-zunit"
|
||||
VERSION=$(curl "https://api.github.com/repos/${USER}/${PROJECT}/tags?per_page=5" | jq '[ .[] | select(.name|test("v[[:digit:].]+$"))]|.[0] | .name')
|
||||
DEB_VERSION=$(echo "${VERSION}" | tr -d "\"" | tr -d "v") # strip the preceding 'v'
|
||||
#VERSION="1.0.0"
|
||||
#ARCH=$(dpkg --print-architecture)
|
||||
MACHINE=$(uname -m)
|
||||
OS=$(uname -s)
|
||||
# DEBEMAIL="person@company.tld"
|
||||
# DEBFULLNAME="Testy McTester"
|
||||
# DESCRIPTION="."
|
||||
# LONG_DESCRIPTION=" ."
|
||||
|
||||
RSS_FEED="https://github.com/${USER}/${PROJECT}/releases.atom"
|
||||
# xdg-open ${RSS_FEED}
|
||||
echo ${RSS_FEED}
|
||||
|
||||
EXCLUDES="/root/.wget-hsts"
|
||||
|
||||
REQUIRES="zsh"
|
||||
BUILD_DIR=/var/tmp/build_zunit
|
||||
ARCH=$(dpkg --print-architecture)
|
||||
if [[ ${ARCH} == "armhf" ]]; then ARCH="arm-v7"; fi
|
||||
|
||||
## Checkinstall variables - see defaults in /etc/checkinstallrc
|
||||
# DOC_DIR=/usr/share/doc
|
||||
# Get latest version from GitHub API (returns "v0.8.2" with quotes)
|
||||
VERSION_JSON=$(curl -s "https://api.github.com/repos/${USER}/${PROJECT}/tags?per_page=1")
|
||||
VERSION=$(echo "${VERSION_JSON}" | jq -r '.[0].name // "v0.8.2"') # fallback
|
||||
DEB_VERSION=${VERSION#v} # → 0.8.2
|
||||
|
||||
# make a new temporary directory for this use to avoid permission issues.
|
||||
BASE_TMP_DIR=~/tmptmp/checkinstall_tmp
|
||||
#-------------------------------------------------------------------------------
|
||||
RELEASE="1" # ← you need to define this (debian revision)
|
||||
LATEST_URL="https://github.com/${USER}/${PROJECT}"
|
||||
|
||||
## Create and populate the install scripts and documentation for checkinstall
|
||||
cat <<-EOF | tee ${BUILD_DIR}/description-pak
|
||||
ZUnit is a powerful unit testing framework for ZSH
|
||||
BUILD_DIR="/var/tmp/build_zunit"
|
||||
mkdir -p "${BUILD_DIR}"
|
||||
cd "${BUILD_DIR}"
|
||||
|
||||
# Optional: better maintainer info
|
||||
export DEBFULLNAME="Your Name"
|
||||
export DEBEMAIL="your@email.example"
|
||||
|
||||
# Create description-pak
|
||||
cat >description-pak <<'EOF'
|
||||
ZUnit is a powerful unit testing framework for ZSH.
|
||||
EOF
|
||||
|
||||
# | preinstall-pak | Run BEFORE the package is INSTALLED |
|
||||
cat <<-EOF | tee ${BUILD_DIR}/preinstall-pak
|
||||
#!/usr/bin/env bash
|
||||
EOF
|
||||
|
||||
# | postinstall-pak | Run AFTER the package is INSTALLED |
|
||||
cat <<-EOF | tee ${BUILD_DIR}/postinstall-pak
|
||||
#!/usr/bin/env bash
|
||||
EOF
|
||||
|
||||
# | preremove-pak | Run BEFORE the package is REMOVED |
|
||||
cat <<-EOF | tee ${BUILD_DIR}/preremove-pak
|
||||
#!/usr/bin/env bash
|
||||
EOF
|
||||
|
||||
# | postremove-pak | Run AFTER the package is REMOVED
|
||||
cat <<-EOF | tee ${BUILD_DIR}/postremove-pak
|
||||
#!/usr/bin/env bash
|
||||
EOF
|
||||
|
||||
## Make the doc-pak directory for README, INSTALL, COPYING, Changelog, TODO, CREDITS
|
||||
mkdir -p ${BUILD_DIR}/doc-pak
|
||||
#cp README INSTALL COPYING Changelog TODO CREDITS doc-pak
|
||||
|
||||
cat <<-EOF | tee ${BUILD_DIR}/doc-pak/README
|
||||
EOF
|
||||
|
||||
cat <<-FOE | tee ${BUILD_DIR}/checkinstall_it.sh
|
||||
|
||||
## Checkinstall variables - see defaults in /etc/checkinstallrc
|
||||
DOC_DIR=/usr/share/doc
|
||||
|
||||
# make a new temporary directory for this use to avoid permission issues.
|
||||
BASE_TMP_DIR=~/tmptmp/checkinstall_tmp
|
||||
mkdir -p '${BASE_TMP_DIR}'
|
||||
|
||||
|
||||
# do your work
|
||||
checkinstall -y --fstrans \
|
||||
--pkgname=${PACKAGE} \
|
||||
--pkgversion=${DEB_VERSION}\
|
||||
--pkgrelease=${RELEASE} \
|
||||
--pkgarch=${ARCH} \
|
||||
--pkggroup=admin \
|
||||
--pkglicense=LICENSE \
|
||||
--pkgsource=${LATEST_URL} \
|
||||
--maintainer=cyteen@ring-zero.co.uk \
|
||||
--requires=${REQUIRES} \
|
||||
--recommends=${RECOMENDS} \
|
||||
--suggests=${SUGGESTS} \
|
||||
--exclude=${EXCLUDES} \
|
||||
-D \
|
||||
bash ${BUILD_DIR}/install.sh
|
||||
FOE
|
||||
|
||||
echo "Writing install.sh to: ${BUILD_DIR}/install.sh"
|
||||
cat <<-FOE | tee ${BUILD_DIR}/install.sh
|
||||
# Minimal install script (what checkinstall will run as "make install")
|
||||
cat >install.sh <<'EOF'
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
#set -x
|
||||
|
||||
# Install revolver
|
||||
INSTALL_DIR=/usr/local/bin
|
||||
curl -L https://raw.githubusercontent.com/molovo/revolver/master/revolver > ${INSTALL_DIR}/revolver
|
||||
INSTALL_DIR="/usr/local/bin"
|
||||
ZSH_COMP_DIR="/usr/share/zsh/vendor-completions"
|
||||
|
||||
chmod +x ${INSTALL_DIR}/revolver
|
||||
# Install revolver dependency
|
||||
curl -L -o "${INSTALL_DIR}/revolver" \
|
||||
https://raw.githubusercontent.com/molovo/revolver/master/revolver
|
||||
chmod +x "${INSTALL_DIR}/revolver"
|
||||
|
||||
# Build ZUnit from source
|
||||
git clone https://github.com/zunit-zsh/zunit ${BUILD_DIR}/zunit
|
||||
cd ${BUILD_DIR}/zunit
|
||||
# Clone & build ZUnit
|
||||
git clone --depth 1 https://github.com/zunit-zsh/zunit.git src
|
||||
cd src
|
||||
./build.zsh
|
||||
|
||||
# Copy zunit into $path
|
||||
cp zunit ${INSTALL_DIR}
|
||||
chmod +x ${INSTALL_DIR}/zunit
|
||||
# Install binary
|
||||
install -m 755 zunit "${INSTALL_DIR}/zunit"
|
||||
|
||||
# Optional, copy ZUnit ZSH completion into $fpath
|
||||
cp zunit.zsh-completion "${fpath[1]}/_zu
|
||||
FOE
|
||||
# Install completion (if exists)
|
||||
if [[ -f zunit.zsh-completion ]]; then
|
||||
install -D -m 644 zunit.zsh-completion "${ZSH_COMP_DIR}/_zunit"
|
||||
fi
|
||||
EOF
|
||||
|
||||
bash ${BUILD_DIR}/checkinstall_it.sh
|
||||
chmod +x install.sh
|
||||
|
||||
# Run checkinstall
|
||||
checkinstall -y --fstrans=no \
|
||||
--pkgname="${PACKAGE}" \
|
||||
--pkgversion="${DEB_VERSION}" \
|
||||
--pkgrelease="${RELEASE}" \
|
||||
--pkgarch="${ARCH}" \
|
||||
--pkggroup="shells" \
|
||||
--pkglicense="MIT" \
|
||||
--pkgsource="${LATEST_URL}" \
|
||||
--maintainer="you@example.com" \
|
||||
--requires="${REQUIRES}" \
|
||||
--deldoc=yes --deldesc=yes --backup=no \
|
||||
--install=no \
|
||||
bash ./install.sh
|
||||
|
||||
echo "Checkinstall .deb should be in current directory."
|
||||
ls -l *.deb
|
||||
|
|
|
|||
Loading…
Reference in New Issue