new package management helpenew package management helper

This commit is contained in:
Jörg Thalheim 2015-09-08 22:40:33 +00:00
parent 9c73145446
commit 2ac3d28115
9 changed files with 31 additions and 61 deletions

3
aur
View File

@ -1,3 +0,0 @@
#!/bin/bash
sudo -u repo HOME=/data/repo local-repo repo "$@"

30
aur-add
View File

@ -1,30 +0,0 @@
#!/bin/bash
for pkg in "$@"; do
if [ -e "$pkg" ]; then
pkg_archive="/tmp/$pkg"
cp "$pkg" "$pkg_archive"
sudo chown repo:repo "$pkg_archive"
shift
name="$(pacman -Qi --file $pkg_archive | awk -e '/Name/ { print $3 } ')"
sudo -u repo HOME=/data/repo sh -c "
cd /
local-repo repo -r \"$name\"
local-repo repo -a \"$pkg_archive\"
"
else
name="$@"
sudo -u repo HOME=/data/repo sh -c "
cd /
local-repo repo -r \"$pkg\"
local-repo repo -A \"$pkg\"
"
fi
[[ "$?" != "0" ]] && exit $?
echo Now you can install the package
echo \$ pacman -Sy $name
done

View File

@ -1,3 +0,0 @@
#!/bin/bash
sudo -u repo HOME=/data/repo local-repo repo -U

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
# TARGET: Backup-Ziel # TARGET: Backup-Ziel
# IGNORE: Liste zu ignorierender Datenbanken (durch | getrennt) # IGNORE: Liste zu ignorierender Datenbanken (durch | getrennt)
IGNORE="mysql|information_schema|performance_schema|test" IGNORE="mysql|information_schema|performance_schema|test"

View File

@ -16,3 +16,4 @@ echo $password | cryptsetup luksOpen /dev/sda3 zfs_hd_1
echo $password | cryptsetup luksOpen /dev/sdb3 zfs_hd_2 echo $password | cryptsetup luksOpen /dev/sdb3 zfs_hd_2
zfs mount -a zfs mount -a
mount -a

View File

@ -25,4 +25,4 @@ CONTAINER_PATH="/data/containers/$CONTAINER"
CGROUP="/system.slice/system-lxc.slice/lxc@${CONTAINER}.service/system.slice/${SERVICE}.service" CGROUP="/system.slice/system-lxc.slice/lxc@${CONTAINER}.service/system.slice/${SERVICE}.service"
UNIT=lxc@${CONTAINER}.service UNIT=lxc@${CONTAINER}.service
journalctl _SYSTEMD_CGROUP=${CGROUP} + SYSLOG_IDENTIFIER=${SERVICE} _SYSTEMD_UNIT=${UNIT} "$@" journalctl --system _SYSTEMD_CGROUP=${CGROUP} + SYSLOG_IDENTIFIER=${SERVICE} _SYSTEMD_UNIT=${UNIT} "$@"

14
lxc-makepkg Executable file
View File

@ -0,0 +1,14 @@
#!/bin/bash
if [ $EUID -ne 0 ]; then
echo "Must be root!" >&2
exit 1
fi
lxc-attach --name login -- sudo -s -u aurrepo -- <<EOF
set -ex
cd "${DIR:-/}"
aurrepo --sign
makepkg --noconfirm "$@"
aurrepo --sign
EOF

14
package-add Executable file
View File

@ -0,0 +1,14 @@
#!/usr/bin/env bash
set -e
if [[ "$#" < 1 ]]; then
echo "USAGE: $0 packages..."
fi
for pkg in "$@"
do
cp -- "$pkg" "/data/containers/login/rootfs/var/lib/aurrepo/"
name="$(basename $pkg)"
lxc-attach -n login -- sudo -u aurrepo gpg --detach-sign --no-armor "/var/lib/aurrepo/$name"
lxc-attach -n login -- pacman -U "/var/lib/aurrepo/$name"
lxc-attach -n login -- sudo -u aurrepo aurrepo --sign --verbose
done

View File

@ -1,23 +0,0 @@
#!/bin/bash
# name of the volume
zname=$(dirname $(dirname $(echo $2 | cut -b 2-)))
# name of the future snapshot
bsname="$zname@rsnap-$(date +%F)"
sname=$bsname
for i in 1 2 3 4 5
do
# exit if success
zfs snapshot "$sname"
if [ "x$?" == "x0" ]; then
echo "backup started at $(date)" > $2/info
exit 0
fi
# iterate over it if already exists
sname=$bsname-v$i
done
echo ERROR zfs_cp: something is really broken
exit 1