aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cgit/cgit.SlackBuild2
-rw-r--r--mirror/README4
-rw-r--r--mirror/doinst.sh43
-rw-r--r--mirror/mirror.SlackBuild70
-rw-r--r--mirror/mirror.info10
-rw-r--r--mirror/mirror.toml10
-rw-r--r--mirror/rc.mirror55
-rw-r--r--mirror/slack-desc19
8 files changed, 212 insertions, 1 deletions
diff --git a/cgit/cgit.SlackBuild b/cgit/cgit.SlackBuild
index 4e192b1..1ae106c 100644
--- a/cgit/cgit.SlackBuild
+++ b/cgit/cgit.SlackBuild
@@ -26,7 +26,7 @@ cd $(dirname $0) ; CWD=$(pwd)
PRGNAM=cgit
VERSION=${VERSION:-1.2.3}
BUILD=${BUILD:-1}
-TAG=${TAG:-_SBo}
+TAG=${TAG:-_slackcoder}
PKGTYPE=${PKGTYPE:-tgz}
DOCROOT=${DOCROOT:-/var/www}
diff --git a/mirror/README b/mirror/README
new file mode 100644
index 0000000..c44d191
--- /dev/null
+++ b/mirror/README
@@ -0,0 +1,4 @@
+Mirror free and open-source projects you like with minimal effort.
+
+Use this project as a service to keep a local or hosted copy of the
+projects source code or their assets.
diff --git a/mirror/doinst.sh b/mirror/doinst.sh
new file mode 100644
index 0000000..60cac25
--- /dev/null
+++ b/mirror/doinst.sh
@@ -0,0 +1,43 @@
+config() {
+ NEW="$1"
+ OLD="$(dirname $NEW)/$(basename $NEW .new)"
+ # If there's no config file by that name, mv it over:
+ if [ ! -r $OLD ]; then
+ mv $NEW $OLD
+ elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then
+ # toss the redundant copy
+ rm $NEW
+ fi
+ # Otherwise, we leave the .new copy for the admin to consider...
+}
+
+preserve_perms() {
+ NEW="$1"
+ OLD="$(dirname $NEW)/$(basename $NEW .new)"
+ if [ -e $OLD ]; then
+ cp -a $OLD ${NEW}.incoming
+ cat $NEW > ${NEW}.incoming
+ mv ${NEW}.incoming $NEW
+ fi
+ config $NEW
+}
+
+if ! getent group mirror >/dev/null; then
+ groupadd mirror \
+ --system
+fi
+
+if ! getent passwd mirror >/dev/null; then
+ useradd mirror \
+ --comment 'Mirror' \
+ --gid mirror \
+ --system \
+ --home-dir /var/empty \
+ --shell /bin/false \
+ || true
+fi
+
+chown mirror:mirror /var/log/mirror
+
+preserve_perms etc/rc.d/rc.mirror.new
+preserve_perms etc/mirror/mirror.toml.new
diff --git a/mirror/mirror.SlackBuild b/mirror/mirror.SlackBuild
new file mode 100644
index 0000000..c87bba3
--- /dev/null
+++ b/mirror/mirror.SlackBuild
@@ -0,0 +1,70 @@
+#!/bin/bash
+
+cd $(dirname $0) ; CWD=$(pwd)
+
+PRGNAM=mirror
+VERSION=${VERSION:-0.0.4}
+BUILD=${BUILD:-1}
+TAG=${TAG:-_slackcoder}
+PKGTYPE=${PKGTYPE:-txz}
+
+if [ -z "$ARCH" ]; then
+ case "$( uname -m )" in
+ i?86) ARCH=i586 ;;
+ arm*) ARCH=arm ;;
+ *) ARCH=$( uname -m ) ;;
+ esac
+fi
+
+if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
+ echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
+ exit 0
+fi
+
+TMP="${TMP:-/tmp/SBo}"
+PKG="$TMP/package-$PRGNAM"
+OUTPUT="${OUTPUT:-/tmp}"
+
+set -e
+
+rm -rf "$PKG"
+mkdir -p "$TMP" "$PKG" "$OUTPUT"
+cd "$TMP"
+rm -rf "$PRGNAM-$VERSION"
+tar xvf "$CWD/$PRGNAM-$VERSION.tar.xz"
+cd "$PRGNAM-$VERSION"
+
+#chown -R root:root .
+find -L . \
+ \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
+ -o -perm 511 \) -exec chmod 755 {} \; -o \
+ \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
+ -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
+
+# Point go to the location of the source tree
+export GOPATH="$TMP/$PRGNAM-$VERSION.gopath"
+export GOBIN="$PKG/usr/sbin"
+
+go install \
+ -ldflags="-linkmode external -extldflags -static -X main.Version=$VERSION" \
+ -a -x ./...
+
+mkdir -p "$PKG/usr/doc/$PRGNAM-$VERSION"
+cp -a \
+ README.md \
+ "$PKG/usr/doc/$PRGNAM-$VERSION"
+cat "$CWD/$PRGNAM.SlackBuild" > "$PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild"
+
+mkdir -p "$PKG/install"
+cat "$CWD/slack-desc" > "$PKG/install/slack-desc"
+cat "$CWD/doinst.sh" > "$PKG/install/doinst.sh"
+
+mkdir -p "$PKG/etc/rc.d"
+cat "$CWD/rc.mirror" > "$PKG/etc/rc.d/rc.mirror.new"
+mkdir -p $PKG/etc/mirror
+cat "$CWD/mirror.toml" > "$PKG/etc/mirror/mirror.toml.new"
+mkdir -p $PKG/etc/mirror/conf.d
+mkdir -p "$PKG/var/log/mirror"
+
+cd "$PKG"
+/sbin/makepkg -l y -c n "$OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
diff --git a/mirror/mirror.info b/mirror/mirror.info
new file mode 100644
index 0000000..414d771
--- /dev/null
+++ b/mirror/mirror.info
@@ -0,0 +1,10 @@
+PRGNAM="mirror"
+VERSION="0.0.4"
+HOMEPAGE="https://git.server.ky/slackcoder/mirror/about"
+DOWNLOAD="https://git.server.ky/slackcoder/mirror/snapshot/mirror-0.0.4.tar.xz"
+MD5SUM="3e554d1e7ad72e88fe1680d156c1f4ac"
+DOWNLOAD_x86_64=""
+MD5SUM_x86_64=""
+REQUIRES="google-go-lang"
+MAINTAINER="Slack Coder"
+EMAIL="slackcoder@server.ky"
diff --git a/mirror/mirror.toml b/mirror/mirror.toml
new file mode 100644
index 0000000..d3522e6
--- /dev/null
+++ b/mirror/mirror.toml
@@ -0,0 +1,10 @@
+[global]
+min-interval = "15s"
+max-interval = "1m"
+
+[[mirrors]]
+method = "git"
+from = "https://github.com/ytdl-org/youtube-dl"
+to = "/home/cypher/Desktop/youtube-dl"
+description = "Command-line program to download videos from YouTube.com and other video sites"
+
diff --git a/mirror/rc.mirror b/mirror/rc.mirror
new file mode 100644
index 0000000..28a1d2f
--- /dev/null
+++ b/mirror/rc.mirror
@@ -0,0 +1,55 @@
+#!/bin/sh
+#
+# Startup/shutdown script for the mirror service.
+#
+
+create_run_dir() {
+ if [ ! -d /run/mirror/ ]; then
+ mkdir -p /run/mirror
+ chown :mirror /run/mirror
+ chmod g+wX /run/mirror
+ fi
+}
+
+mirror_start() {
+ echo "Starting Mirror service"
+ create_run_dir
+
+ daemon \
+ --name=mirror \
+ --user=mirror \
+ --pidfiles=/run/mirror \
+ --output=/var/log/mirror/mirror.log \
+ -- mirror
+}
+
+mirror_stop() {
+ echo "Stopping Mirror service"
+ /usr/bin/daemon --name=mirror --pidfiles=/run/mirror --stop
+}
+
+mirror_reload() {
+ /usr/bin/daemon --name=mirror --pidfiles=/run/mirror --signal=hup
+}
+
+mirror_status() {
+ /usr/bin/daemon --name=mirror --pidfiles=/run/mirror --running --verbose
+}
+
+case "$1" in
+start)
+ mirror_start
+ ;;
+stop)
+ mirror_stop
+ ;;
+reload)
+ mirror_reload
+ ;;
+status)
+ mirror_status
+ ;;
+*)
+ echo "Usage: $0 {start|stop|reload|status}"
+ exit 1
+esac
diff --git a/mirror/slack-desc b/mirror/slack-desc
new file mode 100644
index 0000000..0ae8fd7
--- /dev/null
+++ b/mirror/slack-desc
@@ -0,0 +1,19 @@
+# HOW TO EDIT THIS FILE:
+# The "handy ruler" below makes it easier to edit a package description.
+# Line up the first '|' above the ':' following the base package name, and
+# the '|' on the right side marks the last column you can put a character in.
+# You must make exactly 11 lines for the formatting to be correct. It's also
+# customary to leave one space after the ':' except on otherwise blank lines.
+
+ |-----handy-ruler------------------------------------------------------|
+mirror: mirror (simple mirroring service)
+mirror:
+mirror: Mirror project assets and source code.
+mirror:
+mirror:
+mirror:
+mirror:
+mirror:
+mirror:
+mirror:
+mirror: