dot

packages and services management
Log | Files | Refs | README

commit 16d68c9b20b58b42ab92883cdefe53b212d30b11
parent 2f782001fde98444b1ed046a2c159dba342d630e
Author: Josuah Demangeon <josuah.demangeon@gandi.net>
Date:   Thu, 10 Aug 2017 10:51:21 +0200

added openssh and fixed git configure script

Diffstat:
Mdarkhttpd/start | 2+-
Agit/configure | 14++++++++++++++
Dgit/setup | 7-------
Agit/user | 1+
Aless/profile | 2++
Aopenssh/ssh.core | 0
Aopenssh/sshd.core | 0
Aopenssh/tar | 1+
Mpkg/bin/pkg-configure | 24++++++++++++------------
Mpkg/bin/pkg-service | 37++++++++++++++-----------------------
10 files changed, 45 insertions(+), 43 deletions(-)

diff --git a/darkhttpd/start b/darkhttpd/start @@ -1 +1 @@ -sudo "$(command -v darkhttpd)" "$VAR/www" --default-mimetype text/plain & PID=$! +darkhttpd "$VAR/www" --default-mimetype text/plain & PID=$! diff --git a/git/configure b/git/configure @@ -0,0 +1,14 @@ +cd /home/git || exit + +mkdir -p .ssh && chmod 700 .ssh +touch .ssh/authorized_keys && chmod 600 .ssh/authorized_keys +touch git-shell-commands && chmod 500 git-shell-commands + +git clone --bare http://github.com/josuah/pkg +git clone --bare http://github.com/josuah/www +git clone --bare http://github.com/josuah/cgr +git clone --bare http://github.com/josuah/notes +git clone --bare http://github.com/josuah/iode + +chown -R git . +chgrp -R git . diff --git a/git/setup b/git/setup @@ -1,7 +0,0 @@ -su -c 'adduser git' -su git -c ' - - cd - mkdir .ssh && chmod 700 .ssh - touch .ssh/authorized_keys && chmod 600 .ssh/authorized_keys -' diff --git a/git/user b/git/user @@ -0,0 +1 @@ +git::::::Git service:/home/git:git-shell: diff --git a/less/profile b/less/profile @@ -0,0 +1,2 @@ +export LESS=-MISn +export LESSCHARSET=utf-8 diff --git a/openssh/ssh.core b/openssh/ssh.core Binary files differ. diff --git a/openssh/sshd.core b/openssh/sshd.core Binary files differ. diff --git a/openssh/tar b/openssh/tar @@ -0,0 +1 @@ +https://ftp.fr.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-7.5p1.tar.gz diff --git a/pkg/bin/pkg-configure b/pkg/bin/pkg-configure @@ -22,36 +22,36 @@ find -L "$ROOT" -type l -exec rm {} + 2> /dev/null # --- user --------------------------------------------------------------------- if [ ! -f "$PKG/$1/user" ] -then printf 'no user to add for %s\n' '$1" +then printf 'no user to add for %s\n' "$1" elif [ "$(whoami)" = root ] -then useradd -f "$PKG/$1/user" +then adduser -f "$PKG/$1/user" elif command -v doas -then doas useradd -f "$PKG/$1/user" +then doas adduser -f "$PKG/$1/user" elif command -v sudo -then sudo useradd -f "$PKG/$1/user" +then sudo adduser -f "$PKG/$1/user" elif command -v su -then su -c 'useradd -f "$1"' "$PKG/$1/user" +then su -c 'adduser -f "$1"' "$PKG/$1/user" fi -# --- setup -------------------------------------------------------------------- +# --- configure -------------------------------------------------------------------- -if [ ! -f "$1/setup" ] -then printf 'no setup needed for %s\n' "$1" +if [ ! -f "$PKG/$1/configure" ] +then printf 'no configure needed for %s\n' "$1" elif [ "$(whoami)" = root ] -then sh "$PKG/$1/setup" +then sh "$PKG/$1/configure" elif command -v doas -then doas sh "$PKG/$1/setup" +then doas sh "$PKG/$1/configure" elif command -v sudo -then sudo sh "$PKG/$1/setup" +then sudo sh "$PKG/$1/configure" elif command -v su -then su -c 'sh "$1"' "$PKG/$1/setup" +then su -c 'sh "$1"' "$PKG/$1/configure" fi diff --git a/pkg/bin/pkg-service b/pkg/bin/pkg-service @@ -1,26 +1,20 @@ -usage() -{ - printf '%s ( start | stop | restart | status ) [name]\n' "${0##*/}" - exit 1 -} - - -# --- arguments ---------------------------------------------------------------- - -[ $# -ge 2 ] || usage -cmd=$1 srv=${2%/} -shift 2 +cmd=$1 srv=${2%/} error=0 running=0 acted=0 -case "$cmd" in (start | stop | restart | status) ;; ( * ) usage ;; esac -[ -f "$PKG/$srv/start" ] || usage +case "$cmd" in (start | stop | restart | status) ;; ( * ) error=1 ;; esac +[ $# -ge 2 ] && shift 2 || error=1 - -# --- main --------------------------------------------------------------------- +if [ "$error" = 1 ] +then + printf '%s (start | stop | restart | status) <pkg>\n' "${0##*/}" + exit 1 +elif [ ! -f "$PKG/$srv/start" ] +then + printf 'no start scrit found in %s\n' "$PKG/$1" + exit 1 +fi mkdir -p "$VAR/pid" "$VAR/log" -running=0 act=0 - [ -d "$VAR/pid/$srv" ] && for pid in $(ls "$VAR/pid/$srv") do for arg in "$@" @@ -29,7 +23,7 @@ do if cmp "$VAR/pid/$srv/$pid" "/proc/$pid/cmdline" 2> /dev/null then - act=1 cmdline="$(tr '\0' ' ' < "$VAR/pid/$srv/$pid")" + acted=1 cmdline="$(tr '\0' ' ' < "$VAR/pid/$srv/$pid")" if [ "$cmd" = stop ] || [ "$cmd" = restart ] then @@ -42,7 +36,7 @@ do fi done -[ "$act""$cmd" = '0''status' ] && printf '%-15s [stopped]\n' "$srv" +[ "$acted""$cmd" = '0''status' ] && printf '%-15s [stopped]\n' "$srv" if [ "$running" = 0 ] && [ "$cmd" = start ] || [ "$cmd" = restart ] then @@ -55,9 +49,6 @@ then printf '\n' fi - -# --- wipe --------------------------------------------------------------------- - find "$VAR/pid" -type f | while IFS='' read path do cmp "$path" "/proc/${path##*/}/cmdline" 2> /dev/null || rm -f "$path" done