New SSH authorize file; whatismyip fix; PKGBUILDs
This commit is contained in:
parent
d2deb6bee3
commit
861587a99e
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
src/
|
||||||
|
pkg/
|
||||||
|
*.tar.xz
|
@ -1,6 +1,6 @@
|
|||||||
LIST=arch-update close-guest fix-sound log-guest open-guest restart-service silent-guardian revproxy simple-web wifi wifiboot
|
LIST=arch-update close-guest fix-sound log-guest open-guest restart-service silent-guardian revproxy simple-web wifi wifiboot
|
||||||
LOCATION=/root/bin
|
LOCATION=${pkgbuild}/root/bin
|
||||||
INSTALLER != curl -s https://aninix.net/foundation/installer-test.bash | /bin/bash
|
INSTALLER != curl -s https://aninix.net/foundation/installer-test.bash | bash
|
||||||
PERMISSION=0700
|
PERMISSION=0700
|
||||||
|
|
||||||
compile: ${LIST} ./wifi.service
|
compile: ${LIST} ./wifi.service
|
||||||
@ -8,22 +8,22 @@ compile: ${LIST} ./wifi.service
|
|||||||
|
|
||||||
install: compile
|
install: compile
|
||||||
mkdir -p ${LOCATION};
|
mkdir -p ${LOCATION};
|
||||||
mkdir -p /var/log/aninix/
|
mkdir -p ${pkgbuild}/var/log/aninix/
|
||||||
for i in ${LIST}; do cp ./$$i ${LOCATION}; done
|
for i in ${LIST}; do cp ./$$i ${LOCATION}; done
|
||||||
cp ./wifi.service /usr/lib/systemd/system/wifi.service
|
cp ./wifi.service ${pkgbuild}/usr/lib/systemd/system/wifi.service
|
||||||
make checkperm
|
make checkperm
|
||||||
|
|
||||||
reverse:
|
reverse:
|
||||||
for i in ${LIST}; do cp ${LOCATION}/$$i .; done
|
for i in ${LIST}; do cp ${LOCATION}/$$i .; done
|
||||||
cp /usr/lib/systemd/system/wifi.service .
|
cp ${pkgbuild}/usr/lib/systemd/system/wifi.service .
|
||||||
|
|
||||||
test: ${LIST}
|
test: ${LIST}
|
||||||
for i in ${LIST}; do [ "$$(grep -c '#/bin/bash' $$i)" -ne 1 ]; done
|
for i in ${LIST}; do [ "$$(grep -c '#!/bin/bash' $$i)" -ne 1 ]; done
|
||||||
|
|
||||||
checkperm:
|
checkperm:
|
||||||
for i in ${LIST}; do chown root:root ${LOCATION}/$$i; chmod ${PERMISSION} ${LOCATION}/$$i; done
|
for i in ${LIST}; do chown root:root ${LOCATION}/$$i; chmod ${PERMISSION} ${LOCATION}/$$i; done
|
||||||
chown root: /usr/lib/systemd/system/wifi.service;
|
chown root: ${pkgbuild}/usr/lib/systemd/system/wifi.service;
|
||||||
chmod 0644 /usr/lib/systemd/system/wifi.service
|
chmod 0644 ${pkgbuild}/usr/lib/systemd/system/wifi.service
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
@echo Nothing to do.
|
@echo Nothing to do.
|
||||||
|
@ -20,7 +20,7 @@ echo == Updating Arch Packages == | tee -a $logfile
|
|||||||
if [ ! -z "$apply" ]; then
|
if [ ! -z "$apply" ]; then
|
||||||
pacman -Syu 2>&1 | tee -a $logfile # I've been having troubles with this causing crashes while online.
|
pacman -Syu 2>&1 | tee -a $logfile # I've been having troubles with this causing crashes while online.
|
||||||
# Hook for MediaWiki
|
# 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
|
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
|
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"
|
rsync -avz --exclude images --exclude Images --exclude LocalSettings.php /usr/share/webapps/mediawiki/ "$i"
|
||||||
@ -28,7 +28,7 @@ if [ ! -z "$apply" ]; then
|
|||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
# Hook for Grimoire
|
# 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
|
echo "Updating PostGreSQL databases" | tee -a $logfile
|
||||||
#Clear old backups.
|
#Clear old backups.
|
||||||
rm -Rf /var/lib/postgres/olddata
|
rm -Rf /var/lib/postgres/olddata
|
||||||
|
2
Makefile
2
Makefile
@ -1,6 +1,6 @@
|
|||||||
LIST=Admin Shared ShadowArch
|
LIST=Admin Shared ShadowArch
|
||||||
|
|
||||||
compile: ${LIST} ./wifi.service
|
compile: ${LIST}
|
||||||
for i in ${LIST}; do make -C ./$$i; done
|
for i in ${LIST}; do make -C ./$$i; done
|
||||||
|
|
||||||
install: compile
|
install: compile
|
||||||
|
46
PKGBUILD
Normal file
46
PKGBUILD
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
# Maintainer: Shikoba Kage <darkfeather@aninix.net>
|
||||||
|
pkgname=aninix-misc-scripts
|
||||||
|
pkgver=0.1.d2deb6bee364f1ad7480cb5d97ea74252c266032
|
||||||
|
pkgver() {
|
||||||
|
printf "0.1.""$(git rev-parse HEAD)"
|
||||||
|
}
|
||||||
|
pkgrel=1
|
||||||
|
epoch=
|
||||||
|
pkgdesc="AniNIX::MiscScripts \\\\ Miscellaneous administrative and otherwise helpful scripts"
|
||||||
|
arch=("x86_64")
|
||||||
|
url="https://aninix.net/foundation/MiscScripts"
|
||||||
|
license=('custom')
|
||||||
|
groups=()
|
||||||
|
depends=('curl' 'grep' 'bash>=4.4' 'git>=2.13')
|
||||||
|
makedepends=('make>=4.2')
|
||||||
|
checkdepends=()
|
||||||
|
optdepends=()
|
||||||
|
provides=('aninix-misc-scripts')
|
||||||
|
conflicts=()
|
||||||
|
replaces=()
|
||||||
|
backup=()
|
||||||
|
options=()
|
||||||
|
install=
|
||||||
|
changelog=
|
||||||
|
source=()
|
||||||
|
noextract=()
|
||||||
|
md5sums=()
|
||||||
|
validpgpkeys=()
|
||||||
|
|
||||||
|
prepare() {
|
||||||
|
git pull
|
||||||
|
}
|
||||||
|
|
||||||
|
build() {
|
||||||
|
make -C ..
|
||||||
|
}
|
||||||
|
|
||||||
|
check() {
|
||||||
|
printf 'quit\n\n' | make -C .. test
|
||||||
|
}
|
||||||
|
|
||||||
|
package() {
|
||||||
|
export pkgdir="${pkgdir}"
|
||||||
|
make -C .. install
|
||||||
|
install -D -m644 ../LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
|
||||||
|
}
|
@ -1,5 +1,5 @@
|
|||||||
LIST=bell bigorlittle compare-directories compress-all diff-args expand-all logged-shell standardize-folder whatismyip new-irssi-config replicate-ssh-profiles worktrack
|
LIST=bell bigorlittle compare-directories compress-all diff-args expand-all logged-shell standardize-folder whatismyip new-irssi-config replicate-ssh-profiles worktrack ssh-authorize-host
|
||||||
LOCATION=/usr/local/bin
|
LOCATION=${pkgbuild}/usr/local/bin
|
||||||
INSTALLER != curl -s https://aninix.net/foundation/installer-test.bash | /bin/bash
|
INSTALLER != curl -s https://aninix.net/foundation/installer-test.bash | /bin/bash
|
||||||
PERMISSION=0755
|
PERMISSION=0755
|
||||||
compile:
|
compile:
|
||||||
|
41
Shared/ssh-authorize-host
Executable file
41
Shared/ssh-authorize-host
Executable file
@ -0,0 +1,41 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#--------------------------------------------------------------------#
|
||||||
|
#File: ssh-authorize-host
|
||||||
|
#
|
||||||
|
#Description: Add a public key to a remote SSH-capable host.
|
||||||
|
#
|
||||||
|
#Package: AniNIX::MiscScripts
|
||||||
|
#Copyright: WTFPL
|
||||||
|
#
|
||||||
|
#Author: DarkFeather
|
||||||
|
#Changelog by editor:
|
||||||
|
#--------------------------------------------------------------------#
|
||||||
|
|
||||||
|
|
||||||
|
# Show the usage for this script.
|
||||||
|
function usage {
|
||||||
|
echo "Usage: $0 host [ pubkeyfile ]"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Create the initial SSH command.
|
||||||
|
function initialSSHCommand() {
|
||||||
|
echo 'mkdir -p ${HOME}/.ssh'
|
||||||
|
echo 'touch ${HOME}/.ssh/authorized_keys'
|
||||||
|
echo 'chmod 0700 ${HOME} ${HOME}/.ssh'
|
||||||
|
echo 'chmod 0600 ${HOME}/.ssh/authorized_keys'
|
||||||
|
echo 'chown -R `whoami`":" ${HOME}'
|
||||||
|
echo 'cat > ${HOME}/.ssh/authorized_keys'
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Parse the CLI arguments.
|
||||||
|
host="$1"
|
||||||
|
if [ -z "$host" ]; then usage; exit 1; fi
|
||||||
|
pubkeyfile="$2"
|
||||||
|
if [ -z "$pubkeyfile" ] || [ ! -f "$pubkeyfile" ]; then
|
||||||
|
pubkeyfile="${HOME}/.ssh/id_rsa.pub"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Execute on the remote host.
|
||||||
|
(initialSSHCommand; cat "$pubkeyfile") | ssh "$host" /bin/bash
|
@ -1,2 +1,2 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
/usr/bin/lynx -connect_timeout=5 -read_timeout=5 -timeout=5 --dump whatismyipaddress.com | grep '/ip/' | head -n 1 | cut -f 5 -d '/'
|
/usr/bin/lynx -connect_timeout=5 -read_timeout=5 --dump whatismyipaddress.com | grep '/ip/' | head -n 1 | cut -f 5 -d '/'
|
||||||
|
Loading…
Reference in New Issue
Block a user