summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2024-08-16 21:17:51 -0300
committerEuAndreh <eu@euandre.org>2024-08-16 21:17:51 -0300
commit3bd8330d10b945511f38535d9977a80f24854222 (patch)
tree7d99f3f4e325761b2a2bf1076f72a25e54ff7c2a
parentdeps.mk: Add src/cronjob entry (diff)
downloadsyskeep-3bd8330d10b945511f38535d9977a80f24854222.tar.gz
syskeep-3bd8330d10b945511f38535d9977a80f24854222.tar.xz
Add config files and install them under $(SYSCONFDIR)
-rw-r--r--Makefile7
-rw-r--r--deps.mk3
-rwxr-xr-xmkdeps.sh3
-rw-r--r--src/gitconfig11
-rw-r--r--src/init.scm6
-rw-r--r--src/known_hosts.txt5
-rw-r--r--src/profile.sh5
-rw-r--r--src/rc.sh79
-rw-r--r--src/ssh.conf6
9 files changed, 124 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index ebbb2af..c97b799 100644
--- a/Makefile
+++ b/Makefile
@@ -8,6 +8,7 @@ LANGUAGES = en
PREFIX = /usr
BINDIR = $(PREFIX)/bin
LIBDIR = $(PREFIX)/lib
+SYSCONFDIR = $(PREFIX)/etc
INCLUDEDIR = $(PREFIX)/include
SRCDIR = $(PREFIX)/src/$(NAME)
SHAREDIR = $(PREFIX)/share
@@ -29,6 +30,7 @@ include deps.mk
sources = \
$(sources.sh) \
+ $(sources.txt) \
derived-assets = \
@@ -67,9 +69,11 @@ clean:
install: all
mkdir -p \
'$(DESTDIR)$(BINDIR)' \
+ '$(DESTDIR)$(SYSCONFDIR)' \
'$(DESTDIR)$(SRCDIR)' \
cp $(sources.sh) '$(DESTDIR)$(BINDIR)'
+ cp $(sources.txt) '$(DESTDIR)$(SYSCONFDIR)'
cp $(sources) '$(DESTDIR)$(SRCDIR)'
@@ -83,6 +87,9 @@ uninstall:
for f in $(sources.sh); do \
rm -f '$(DESTDIR)$(BINDIR)'/"$${f#src/}"; \
done
+ for f in $(sources.txt); do \
+ rm -f '$(DESTDIR)$(SYSCONFDIR)'/"$${f#src/}"; \
+ done
ALWAYS:
diff --git a/deps.mk b/deps.mk
index 095d0df..af8093a 100644
--- a/deps.mk
+++ b/deps.mk
@@ -4,3 +4,6 @@ sources.sh = \
src/gc \
src/reconfigure \
+sources.txt = \
+ src/backupit.txt \
+
diff --git a/mkdeps.sh b/mkdeps.sh
index 8204798..55049c3 100755
--- a/mkdeps.sh
+++ b/mkdeps.sh
@@ -10,4 +10,5 @@ varlist() {
}
-find src/* -type f -perm -111 | varlist 'sources.sh'
+find src/* -type f -perm -111 | varlist 'sources.sh'
+find src/* -type f -not -perm -111 | varlist 'sources.txt'
diff --git a/src/gitconfig b/src/gitconfig
new file mode 100644
index 0000000..f1f1eb3
--- /dev/null
+++ b/src/gitconfig
@@ -0,0 +1,11 @@
+[init]
+ defaultBranch = main
+[user]
+ email = ci@$TLD
+ name = "Git CI"
+[advice]
+ detachedHead = false
+[receive]
+ advertisePushOptions = true
+[uploadpack]
+ allowAnySHA1InWant = true
diff --git a/src/init.scm b/src/init.scm
new file mode 100644
index 0000000..9e962e8
--- /dev/null
+++ b/src/init.scm
@@ -0,0 +1,6 @@
+(use-modules
+ (ice-9 colorized)
+ (ice-9 readline))
+
+(activate-colorized)
+(activate-readline)
diff --git a/src/known_hosts.txt b/src/known_hosts.txt
new file mode 100644
index 0000000..74ba219
--- /dev/null
+++ b/src/known_hosts.txt
@@ -0,0 +1,5 @@
+# rsync.net public keys
+# Verified in 2023-03-08 at:
+# https://www.rsync.net/resources/fingerprints.txt
+
+hk-s020.rsync.net ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILcPl9x9JfRFwsn09NnDw/xBZbAN80ZQck+h6AqlVqPH
diff --git a/src/profile.sh b/src/profile.sh
new file mode 100644
index 0000000..1dca8b2
--- /dev/null
+++ b/src/profile.sh
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+# shellcheck source=/dev/null
+. /etc/rc
+ln -fs .profile .bashrc
diff --git a/src/rc.sh b/src/rc.sh
new file mode 100644
index 0000000..c79d6d7
--- /dev/null
+++ b/src/rc.sh
@@ -0,0 +1,79 @@
+#!/bin/sh
+
+# shellcheck source=/dev/null
+. /etc/profile
+
+export XDG_PREFIX=~/.usr
+export XDG_CACHE_HOME="$XDG_PREFIX"/var/cache
+export XDG_CONFIG_HOME="$XDG_PREFIX"/etc
+export XDG_DATA_HOME="$XDG_PREFIX"/share
+export XDG_STATE_HOME="$XDG_PREFIX"/state
+export XDG_LOG_HOME="$XDG_PREFIX"/var/log
+
+
+HOME_PARENT="$(dirname "$HOME")"
+if [ "$HOME_PARENT" = '/home' ] || [ "$HOME_PARENT" = '/' ]; then
+ mkdir -p \
+ "$XDG_CONFIG_HOME" \
+ "$XDG_CACHE_HOME" \
+ "$XDG_DATA_HOME" \
+ "$XDG_LOG_HOME" \
+ "$XDG_STATE_HOME"/ssh/conn
+fi
+
+
+GUIX_PROFILE="$XDG_CONFIG_HOME"/guix/current
+if [ -r "$GUIX_PROFILE"/etc/profile ]; then
+ # shellcheck source=/dev/null
+ . "$GUIX_PROFILE"/etc/profile
+fi
+
+export ENV=~/.profile
+export HISTSIZE=-1
+export HISTCONTROL=ignorespace:ignoredups
+export EDITOR=vi
+export VISUAL="$EDITOR"
+export PAGER='less -R'
+
+export EXINIT='
+ " set number
+ " set autoindent
+ set ruler
+ set showmode
+ set showmatch
+'
+
+export HISTFILE="$XDG_STATE_HOME"/bash-history
+export LESSHISTFILE="$XDG_STATE_HOME"/lesshst
+export RLWRAP_HOME="$XDG_CACHE_HOME"/rlwrap
+export GUILE_HISTORY="$XDG_STATE_HOME"/guile-history
+
+HOSTNAME="$(hostname)"
+export BORG_REPO="$OFFSITE_SSH:borg/$HOSTNAME"
+export BORG_REMOTE_PATH='borg1'
+export BORG_PASSCOMMAND='cat /opt/secrets/borg-passphrase.txt'
+
+export GIT_CONFIG_GLOBAL=/etc/gitconfig
+
+unalias -a
+alias l='ls -lahF --color'
+alias grep='grep --color=auto'
+alias diff='diff --color=auto'
+alias watch='watch --color '
+alias man='MANWIDTH=$((COLUMNS > 80 ? 80 : COLUMNS)) man'
+alias less='less -R'
+alias tree='tree -aC'
+alias mv='mv -i'
+alias e='vi'
+
+alias sqlite='rlwrap sqlite3'
+alias guile='guile -l /etc/init.scm'
+
+error_marker() {
+ STATUS=$?
+ if [ "$STATUS" != 0 ]; then
+ printf ' (!! %s !!) ' "$STATUS"
+ fi
+}
+export PS1='`error_marker`\T \w/
+\u@\H\$ '
diff --git a/src/ssh.conf b/src/ssh.conf
new file mode 100644
index 0000000..ca41df0
--- /dev/null
+++ b/src/ssh.conf
@@ -0,0 +1,6 @@
+Host *
+ ServerAliveInterval 30
+ ServerAliveCountMax 20
+ ControlMaster auto
+ ControlPath ${XDG_STATE_HOME}/ssh/conn/%r@%h:%p
+ ControlPersist 1h