Renaming package to ShadowArch to follow /wiki/Design_Principles; improved packing; development sync to current state -- massive overhaul

This commit is contained in:
DarkFeather 2019-05-06 02:04:19 -05:00
parent deac12d010
commit c12535de2e
176 changed files with 289 additions and 235 deletions

View File

@ -1,27 +0,0 @@
# http://www.wtfpl.net/about/
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. You just DO WHAT THE FUCK YOU WANT TO.
ANINIX ADDENDUM
Trademark Pending 2017 (https://aninix.net/irc/)
The "AniNIX" name and |> logo is trademark-pending as of 2017. All
AniNIX materials can be reproduced and re-used, though you must
contact the admins of the network to get written permission to use
the AniNIX name.
Attribution is appreciated for other materials but not legally
required or necessary.

View File

@ -1,33 +0,0 @@
LIST=arch-update close-guest fix-sound log-guest open-guest restart-service silent-guardian revproxy simple-web wifi wifiboot
LOCATION=${pkgbuild}/root/bin
INSTALLER != curl -s https://aninix.net/foundation/installer-test.bash | bash
PERMISSION=0700
compile: ${LIST} ./wifi.service
@echo Nothing to compile.
install: compile
mkdir -p ${LOCATION};
mkdir -p ${pkgbuild}/var/log/aninix/
for i in ${LIST}; do cp ./$$i ${LOCATION}; done
cp ./wifi.service ${pkgbuild}/usr/lib/systemd/system/wifi.service
make checkperm
reverse:
for i in ${LIST}; do cp ${LOCATION}/$$i .; done
cp ${pkgbuild}/usr/lib/systemd/system/wifi.service .
test: ${LIST}
for i in ${LIST}; do [ "$$(grep -c '#!/bin/bash' $$i)" -ne 1 ]; done
checkperm:
for i in ${LIST}; do chown root:root ${LOCATION}/$$i; chmod ${PERMISSION} ${LOCATION}/$$i; done
chown root: ${pkgbuild}/usr/lib/systemd/system/wifi.service;
chmod 0644 ${pkgbuild}/usr/lib/systemd/system/wifi.service
clean:
@echo Nothing to do.
diff:
count=0; for i in ${LIST}; do echo $$i; diff ./$$i ${LOCATION}/$$i; if [ $$? -ne 0 ]; then count=$$(( $$count + 1 )); fi; echo; done; echo Found $$count files to be different.

View File

@ -1,7 +0,0 @@
#!/bin/bash
if [ "$1" == "" ]; then echo Need a service name ; exit; fi
systemctl daemon-reload
systemctl restart $1
sleep 3
systemctl status -l $1

View File

@ -1,12 +0,0 @@
[Unit]
Description=Wifi Connectivity Service
Wants=network-online.target
After=network-online.target
[Service]
ExecStart=/root/bin/wifiboot
Type=oneshot
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target

28
AdminScripts/Makefile Normal file
View File

@ -0,0 +1,28 @@
list=arch-update close-guest fix-sound log-guest open-guest restart-service silent-guardian revproxy simple-web netcli
location=${pkgdir}/usr/local/sbin
perms=0700
compile: ${list}
@echo Nothing to compile.
install: compile
mkdir -p ${location};
for i in ${list}; do cp ./$$i ${location}; done
make checkperm
reverse:
for i in ${list}; do cp ${location}/$$i .; done
cp ${pkgdir}/usr/lib/systemd/system/wifi.service .
test: ${list}
for i in ${list}; do [ "$$(grep -c '#!/bin/bash' $$i)" -ne 1 ]; done
checkperm:
for i in ${list}; do chown root:root ${location}/$$i; chmod ${perms} ${location}/$$i; done
clean:
@echo Nothing to do.
diff:
count=0; for i in ${list}; do echo $$i; diff ./$$i ${location}/$$i; if [ $$? -ne 0 ]; then count=$$(( $$count + 1 )); fi; echo; done; echo Found $$count files to be different.

View File

@ -1,5 +1,6 @@
#!/bin/bash
set -x
export logfile="/var/log/sysupdate.log"
export tmpfile=/tmp/shadowarch-cowerfile
unset apply
@ -18,17 +19,21 @@ date > $logfile
# Update
echo == Updating Arch Packages == | tee -a $logfile
if [ ! -z "$apply" ]; then
pacman -Syu 2>&1 | tee -a $logfile # I've been having troubles with this causing crashes while online.
pacman -Syu --force 2>&1 | tee -a $logfile # I've been having troubles with this causing crashes while online.
# Hook for MediaWiki
if [ `grep $(date +%F) /var/log/pacman.log | grep -c mediawiki` -eq 1 ] && [ -d /usr/share/webapps/mediawiki ]; then
if [ `grep $(date +$F) /var/log/pacman.log | grep -c mediawiki` -eq 1 ] && [ -d /usr/share/webapps/mediawiki ]; then
php /usr/share/webapps/mediawiki/maintenance/update.php | tee -a $logfile
for i in `find /usr/share/webapps/ -maxdepth 1 -type d | grep mediawiki\-`; do
rsync -avz --exclude images --exclude Images --exclude LocalSettings.php /usr/share/webapps/mediawiki/ "$i"
php "$i"/maintenance/update.php
done
fi
# Hook for TT-RSS
if [ `grep $(date +$F) /var/log/pacman.log | grep -c tt-rss` -eq 1 ] && [ -d /usr/share/webapps/tt-rss ]; hten
/usr/bin/runuser -u http -- /usr/bin/php /usr/share/webapps/tt-rss/update.php --update-schema
fi
# Hook for Grimoire
if [ `grep $(date +%F) /var/log/pacman.log | grep -c 'upgraded postgresql '` -eq 1 ]; then
if [ `grep $(date +$F) /var/log/pacman.log | grep -c 'upgraded postgresql '` -eq 1 ]; then
echo "Updating PostGreSQL databases" | tee -a $logfile
#Clear old backups.
rm -Rf /var/lib/postgres/olddata
@ -76,7 +81,7 @@ echo | tee -a $logfile
# Update AniNIX packages
echo == Updating AniNIX Packages == | tee -a $logfile
if [ ! -z "$apply" ]; then
for i in `find /usr/local/src/ -maxdepth 6 -type f -name config -exec egrep -l aninix\|foundation {} \; | sed 's#.git/config$##'`; do
for i in ; do #`find /usr/local/src/ -maxdepth 6 -type f -name config -exec egrep -l aninix\|foundation {} \; | sed 's#.git/config$##'`; do
cd "$i"
git pull
make
@ -96,5 +101,3 @@ pacman -Qdtq > /var/log/orphaned-packages.txt
echo | tee -a $logfile
date | tee -a $logfile
printf '\n\n' | tee -a $logfile
if [ -z "$apply" ]; then cat $logfile | mail -s "AniNIX::$(hostname) Update Candidates" sh1k0b4@gmail.com; fi

12
AdminScripts/restart-service Executable file
View File

@ -0,0 +1,12 @@
#!/bin/bash
if [ "$1" == "" ]; then
echo Usage: $0 '[service(s)...]';
exit 1;
fi
for i in $@; do
systemctl daemon-reload
systemctl restart $i
sleep 3
systemctl status -l $i | head -n 6
done

View File

@ -0,0 +1,12 @@
#!/bin/bash
# File: shadowarch-sync
#
# Description: This file syncs the ShadowArch customization files over the ones created by other packages, like filesystem and pacman
#
# Package: AniNIX::Foundation/ShadowArch
# Copyright: WTFPL
#
# Author: DarkFeather <darkfeather@aninix.net>
rsync -avz /opt/aninix/ShadowArch/etc/ /etc/

View File

@ -17,23 +17,14 @@ find /srv/http/* -type d -exec chmod 0750 {} \;
fi;
# Fix the media permissions
if [ -f /usr/lib/systemd/system/yggdrasil.service ]; then
chown -R $DEPRIV:http /srv/yggdrasil
/usr/local/bin/yggdrasil-lock
fi
/usr/local/bin/yggdrasil-lock
# fix the WolfPack results location
if [ -x /usr/local/bin/wolfpack ]; then
find /srv/wolfpack -type d -exec chmod 0755 {} \;
find /srv/wolfpack -type f -exec chmod 0644 {} \;
fi
# Seal the special directories.
for i in $(ls -a /srv/yggdrasil/Digital_Library/ | egrep '^\.[a-zA-Z0-9]+$'); do
chown $DEPRIV:$DEPRIV -R $i;
find $i -type f -exec chmod 0400 {} \;
find $i -type d -exec chmod 0500 {} \;
done
# Guard root
chmod 0700 /root
chown -R root:root /root
@ -42,12 +33,6 @@ find /root -type d -exec chmod 0700 {} \;
# Guard home directories
chmod 0750 /home/*
# Guard API's
if [ -f /usr/local/bin/api-keys ]; then
chmod 0750 /usr/local/bin/api-keys
chown root:api /usr/local/bin/api-keys
fi
# Guard LDAP
if [ -d /etc/openldap ]; then
chown ldap:ldap /var/lib/openldap/openldap-data/*

46
EtcFiles/Makefile Normal file
View File

@ -0,0 +1,46 @@
httpRoot = ${pkgdir}/srv/http/aninix.net
httpUser = http
syncList = vimrc bashrc tmux.conf profile pacman.conf
serviceList = tmux@.service ssh-agent@.service
compile: ./shadowarch
@echo Nothing to compile
install: compile
mkdir -p ${pkgdir}/opt/aninix/ShadowArch/etc/
mkdir -p ${pkgdir}/usr/lib/systemd/system
for i in ${syncList}; do cp "$$i" ${pkgdir}/opt/aninix/ShadowArch/etc/; done
for i in ${serviceList}; do cp "$$i" ${pkgdir}/usr/lib/systemd/system/"$$i"; done
cp -pr ./skel ${pkgdir}/opt/aninix/ShadowArch/etc
repository: shadowarch ${httpRoot}
cp ./shadowarch ${httpRoot}
checkperm: ${syncList}
printf "What is your deprivileged user? "; read user; chown -R ${user}:${user} .
if [ -f ${httpRoot}/shadowarch ]; then chmod 0755 ${httpRoot}/shadowarch; chown ${httpUser} ${httpRoot}/shadowarch; fi
chown -R root:root ${syncList}
for i in ${syncList}; do if [ -f "${i}" ]; then chmod 0644 "${i}"; elif [ -d "${i}" ]; then chmod 0755 "${i}"; fi; done
test:
bash -n shadowarch
bash ./shadowarch -h
echo Success.
reverse: ${httpRoot}/shadowarch ${syncList}
cat ${httpRoot}/shadowarch > ./shadowarch
for i in ${syncList}; do rsync -avz ${syncList} .; done
for i in ${serviceList}; do rsync -avz ${serviceList} .; done
rsync --delete-before -avz ${pkgdir}/opt/aninix/ShadowArch/etc/skel ./skel
clean:
@echo Nothing to do.
diff: ${syncList}
if [ -f ${httpRoot}/shadowarch ]; then diff ./shadowarch ${httpRoot}/shadowarch; echo; fi
for i in ${syncList}; do diff -rc "$$i" ./`echo $$i | rev | cut -f 1 -d '/' | rev`; echo; done
diff -rc ${pkgdir}/opt/aninix/ShadowArch/etc/skel ./skel; printf ""
find-missing-hooks-in-src:
@for i in `wget -q -O - https://aninix.net/foundation/ | grep toplevel-repo | cut -f 4 -d \'`; do if [ -z $$i ]; then continue; fi; for file in `find ../.. -type f -name Makefile | grep $$i`; do if [ -z "$$file" ]; then echo NO MAKEFILE FOR $$i; elif [ `grep -c -i 'hook for systemd' $$file` -eq 0 ]; then echo HOOK MISSING IN: $$file; else echo HOOK FOUND IN: $$file; fi; done; done
@for i in `wget -q -O - https://aninix.net/foundation/ | grep toplevel-repo | cut -f 4 -d \'`; do if [ -z $$i ]; then continue; fi; for file in `find ../.. -type f -name Makefile | grep $$i`; do if [ -z "$$file" ]; then echo NO MAKEFILE FOR $$i; elif [ `grep -c useradd $$file` -eq 0 ]; then echo DEPRIV MISSING IN: $$file; else echo DEPRIV FOUND IN: $$file; fi; done; done

View File

@ -5,11 +5,11 @@
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
PS1='\[\033[00;31m\][ AniNIX::\h(\[\033[01;32m\]`uname -o`\[\033[00;31m\]) \[\033[00;36m\]\u \[\033[01;37m\]\d \t \[\033[00;35m\]\w\[\033[00;31m\] ] \n|\[\033[m\]> '
organization="$(hostname | rev | cut -f 2 -d '.' | rev)"
PS1='\[\033[00;31m\][ '"${org^^}"'::\h/\[\033[01;32m\]\u \[\033[00;31m\]\\\\\\\\ ${SHELL} {\[\033[m\]$? \[\033[00;36m\]\D{%F-%R} \[\033[00;35m\]\w\[\033[00;31m\]\[\033[00;31m\]} ]\n|\[\033[m\]> '
PS2='> '
PS3='> '
PS4='+ '
case ${TERM} in
xterm*|rxvt*|Eterm|aterm|kterm|gnome*)
PROMPT_COMMAND=${PROMPT_COMMAND:+$PROMPT_COMMAND; }'printf "\033]0;AniNIX::%s \134\134 %s in %s\007" "${HOSTNAME%%.*}" "${USER}" "${PWD/#$HOME/\~}"'
@ -24,6 +24,7 @@ esac
# https://bugs.archlinux.org/task/55841
#[ -r /usr/share/bash-completion/bash_completion ] && . /usr/share/bash-completion/bash_completion
### MOTD ###
[ -f /etc/bash.motd ] && cat /etc/bash.motd
### AniNIX Customizations ###
@ -37,22 +38,25 @@ alias make-entrypoints="egrep '^[a-zA-Z0-9\-]*:' Makefile"
if [ -x `which torsocks 2>/dev/null` ] && [ `systemctl status tor 2>/dev/null| grep -c running` -eq 1 ]; then
alias tor-lynx="torsocks lynx https://check.torproject.org/";
fi
IFS="
"
# Irssi
for i in `ls -d ~/.irssi-* 2>/dev/null`; do
alias `echo $i | cut -f 2 -d '-' | tr '[:upper:]' '[:lower:]'`="irssi --home=$i";
done
# SSH
for i in `egrep '^Host' ~/.ssh/config | cut -f 2 -d ' '`; do
### SSH ###
# Aliases for hosts
if [ -f ~/.ssh/config ]; then
for i in `egrep '^Host' ~/.ssh/config | grep -v \* | cut -f 2 -d ' '`; do
alias "$i"="ssh $i";
done
done
fi
# Tell shell about ssh-agent -- enable with 'systemctl enable ssh-agent@$USER.service'
SSH_AGENT_PID="$(ps -feu "$USER" | grep -v grep | grep -m 1 ssh-agent | awk '{ print $2; }')"
if [ -n "$SSH_AGENT_PID" ]; then
SSH_AUTH_SOCK="$(ls -1 /tmp/ssh-*/agent.$(( $SSH_AGENT_PID - 1 )))"
echo ssh-agent PID is $SSH_AGENT_PID
fi
# Set up screen/tmux safety nest by default for remote sessions
if [ ! -z "$SSH_CLIENT" ]; then
# Prefer tmux
if [ -x "$(which tmux 2>/dev/null)" ] && [ -z "$TMUX" ]; then
if [ `tmux list-sessions | grep created | wc -l` -eq 0 ]; then
exec tmux
@ -62,6 +66,7 @@ if [ ! -z "$SSH_CLIENT" ]; then
tmux list-sessions
fi
alias tat="exec tmux a -d -t"
# Fallback on Screen
elif [ -x "$(which screen 2>/dev/null)" ] && [ "$TERM" != "screen" ]; then
if [ `screen -list | grep -c 'Detached'` -eq 1 ]; then
exec screen -r
@ -72,7 +77,9 @@ if [ ! -z "$SSH_CLIENT" ]; then
fi
alias sdr="screen -d -r"
fi;
elif [ `who -m | egrep "^$(whoami)" | awk '{ print $2; }' | egrep -c "^tty"` -eq 1 ] && [ -x /usr/sbin/startxfce4 ] && [ `pgrep -ac xinit` -eq 0 ]; then
### XFCE4 ###
elif [ `who -m | egrep "^$(whoami)" | awk '{ print $2; }' | egrep -c "^tty"` -eq 1 ] && [ -x /usr/sbin/startxfce4 ] && [ `pgrep -ac xinit` -eq 0 ] && [ `whoami` != 'root' ]; then
exec startxfce4
fi

111
EtcFiles/pacman.conf Normal file
View File

@ -0,0 +1,111 @@
#
# /etc/pacman.conf
#
# See the pacman.conf(5) manpage for option and repository directives
#
# GENERAL OPTIONS
#
[options]
# The following paths are commented out with their default values listed.
# If you wish to use different paths, uncomment and update the paths.
#RootDir = /
#DBPath = /var/lib/pacman/
#CacheDir = /var/cache/pacman/pkg/
#LogFile = /var/log/pacman.log
#GPGDir = /etc/pacman.d/gnupg/
#HookDir = /etc/pacman.d/hooks/
#HoldPkg = pacman glibc
#XferCommand = /usr/bin/curl -C - -f %u > %o
#XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u
CleanMethod = KeepCurrent
#UseDelta = 0.7
Architecture = auto
# Pacman won't upgrade packages listed in IgnorePkg and members of IgnoreGroup
IgnorePkg = mediawiki postgresql postgresql-libs
# IgnorePkg = postgresql postgresql-libs
#IgnoreGroup =
#NoUpgrade =
#NoExtract =
# Misc options
#UseSyslog
Color
ILoveCandy
#TotalDownload
CheckSpace
#VerbosePkgLists
# By default, pacman accepts packages signed by keys that its local keyring
# trusts (see pacman-key and its man page), as well as unsigned packages.
SigLevel = Required DatabaseOptional
LocalFileSigLevel = Optional
#RemoteFileSigLevel = Required
# NOTE: You must run `pacman-key --init` before first using pacman; the local
# keyring can then be populated with the keys of all official Arch Linux
# packagers with `pacman-key --populate archlinux`.
#
# REPOSITORIES
# - can be defined here or included from another file
# - pacman will search repositories in the order defined here
# - local/custom mirrors can be added here or in separate files
# - repositories listed first will take precedence when packages
# have identical names, regardless of version number
# - URLs will have $repo replaced by the name of the current repo
# - URLs will have $arch replaced by the name of the architecture
#
# Repository entries are of the format:
# [repo-name]
# Server = ServerName
# Include = IncludePath
#
# The header [repo-name] is crucial - it must be present and
# uncommented to enable the repo.
#
# The testing repositories are disabled by default. To enable, uncomment the
# repo name header and Include lines. You can add preferred servers immediately
# after the header, and they will be used before the default mirrors.
#[testing]
#Include = /etc/pacman.d/mirrorlist
[core]
Include = /etc/pacman.d/mirrorlist
[extra]
Include = /etc/pacman.d/mirrorlist
#[community-testing]
#Include = /etc/pacman.d/mirrorlist
[community]
Include = /etc/pacman.d/mirrorlist
# If you want to run 32 bit applications on your x86_64 system,
# enable the multilib repositories as required here.
#[multilib-testing]
#Include = /etc/pacman.d/mirrorlist
[multilib]
Include = /etc/pacman.d/mirrorlist
# An example of a custom package repository. See the pacman manpage for
# tips on creating your own repositories.
#[custom]
#SigLevel = Optional TrustAll
#Server = file:///home/custompkgs
[aninix]
SigLevel = Optional TrustAll
Server = https://aninix.net/maat/
[aur]
SigLevel = Optional TrustAll
Server = https://aninix.net/maat/aur/

View File

@ -29,10 +29,4 @@ unset TERMCAP
# Man is much better than us at figuring this out
unset MANPATH
if /bin/bash -c "[[ $(tty) =~ \"/dev/tty\" ]]" &>/dev/null; then
whoami=`whoami`
if [ `id | grep -c \(tty-allow\)` -ne 1 ] && [ `whoami` != "root" ]; then
exit
fi
fi

View File

@ -150,13 +150,13 @@ fi
# Install ArchLinux with basic clients for the AniNIX Services.
# * git for Foundation
# * lynx for WebServer and Wiki
# * elinks for WebServer and Wiki
# * openssh for SSH/SFTP
# * irssi for IRC
# * weechat for IRC
# * make for source packages
# * tor for anonymity
header Installing ArchLinux to device\(s\) on /mnt
export pkglist="base base-devel parted net-tools bind-tools git openssh make lynx irssi vim wget tor torsocks grub os-prober rsync openntpd tmux efibootmgr"
export pkglist="base base-devel parted net-tools bind-tools git openssh make elinks weechat vim wget tor torsocks grub os-prober rsync openntpd tmux efibootmgr"
if [ ! -z "$gui" ]; then
export pkglist="$pkglist"" xorg-server xfce4 chromium conky tigervnc xscreensaver"
fi
@ -164,7 +164,7 @@ if [ ! -z "$spartacus" ]; then
export pkglist="$pkglist"" exfat-utils"
fi
if [ ! -z "$productivity" ]; then
export pkglist="$pkglist"" libreoffice-still gimp feh vlc evince"
export pkglist="$pkglist"" libreoffice-still gimp feh vlc evince openshot"
fi
if [ ! -z "$kali" ]; then
export pkglist="$pkglist"" extundelete testdisk nmap tcpdump hexedit dcfldd"

Some files were not shown because too many files have changed in this diff Show More