diff --git a/alpine/gitea/build.sh b/alpine/gitea/build.sh index 5365b0e..3c27ae3 100755 --- a/alpine/gitea/build.sh +++ b/alpine/gitea/build.sh @@ -1,40 +1,38 @@ #!/bin/sh +set -e + [ -z $ROOTFS ] && ROOTFS=/tmp/gitea [ -z $ALPINE_VERSION ] && ALPINE_VERSION=3.10 [ -z $ALPINE_RELEASE ] && ALPINE_RELEASE=0 ALPINE_TARBALL=alpine-minirootfs-$ALPINE_VERSION.$ALPINE_RELEASE-x86_64.tar.gz -[ -f $ROOTFS.raw ] && sudo rm $ROOTFS.raw +[ -f $ROOTFS.raw ] && rm $ROOTFS.raw [ -f $ALPINE_TARBALL ] || wget http://dl-cdn.alpinelinux.org/alpine/v$ALPINE_VERSION/releases/x86_64/$ALPINE_TARBALL -sudo systemctl stop gitea.service && sudo portablectl detach gitea +(sudo systemctl stop gitea.service && sudo portablectl detach gitea) || echo "Image not attached." -sudo mkdir -p $ROOTFS -sudo tar xf $ALPINE_TARBALL -C $ROOTFS/ +mkdir -p $ROOTFS +tar xf $ALPINE_TARBALL -C $ROOTFS/ -sudo mkdir -p \ +chmod 755 $ROOTFS + +mkdir -p \ $ROOTFS/etc/systemd/system \ - $ROOTFS/var/{lib,run,tmp} \ - $ROOTFS/{dev,tmp,proc,root,run,sys} \ $ROOTFS/etc/gitea \ $ROOTFS/var/lib/gitea \ - $ROOTFS/dev/log \ - $ROOTFS/run/systemd/journal \ - $ROOTFS/run/{dbus,gitea} \ - $ROOTFS/{proc,sys,dev} \ - $ROOTFS/var/tmp/ \ + $ROOTFS/run/gitea \ $ROOTFS/root/.ssh -sudo touch $ROOTFS/etc/machine-id $ROOTFS/etc/resolv.conf +touch $ROOTFS/etc/machine-id $ROOTFS/etc/resolv.conf sudo systemd-nspawn --directory $ROOTFS/ /sbin/apk update sudo systemd-nspawn --directory $ROOTFS/ /sbin/apk add --no-cache gitea openssh-keygen -# sudo systemd-nspawn --directory $ROOTFS/ /bin/rm -rf /etc/apk /root/.cache /root/.config /var/cache/* +sudo systemd-nspawn --directory $ROOTFS/ /bin/rm -rf /etc/apk/* /var/cache/* -sudo cp systemd/* $ROOTFS/etc/systemd/system/ +cp systemd/* $ROOTFS/etc/systemd/system/ -sudo mksquashfs $ROOTFS/ $ROOTFS.raw -all-root -noappend -#sudo rm -rf $ROOTFS +rm -f $ROOTFS.raw +mksquashfs $ROOTFS/ $ROOTFS.raw -all-root -noappend sudo portablectl attach $ROOTFS.raw diff --git a/alpine/gitea/systemd/gitea.service b/alpine/gitea/systemd/gitea.service index 139fee3..7b17a27 100644 --- a/alpine/gitea/systemd/gitea.service +++ b/alpine/gitea/systemd/gitea.service @@ -1,6 +1,8 @@ [Unit] Description=Gitea (Git with a cup of tea) After=network.target +#Requires=sshd.socket + #Requires=mysql.service #Requires=mariadb.service #Requires=postgresql.service @@ -8,17 +10,13 @@ After=network.target #Requires=redis.service [Service] -Type=simple -User=gitea +User=git Group=www-data - -Environment=USER=gitea HOME=/var/lib/gitea GITEA_WORK_DIR=/var/lib/gitea WorkingDirectory=/var/lib/gitea +Environment=USER=git HOME=/var/lib/gitea GITEA_WORK_DIR=/var/lib/gitea -ExecStart=/bin/ls -al /etc/gitea/ -#ExecStart=/usr/bin/gitea web -c /etc/gitea/app.ini +ExecStart=/usr/bin/gitea web -c /etc/gitea/app.ini -RuntimeDirectory=gitea StateDirectory=gitea ConfigurationDirectory=gitea diff --git a/alpine/matrix/build.sh b/alpine/matrix/build.sh index 917ca49..0682477 100644 --- a/alpine/matrix/build.sh +++ b/alpine/matrix/build.sh @@ -18,7 +18,6 @@ mkdir -p \ touch $ROOTFS/etc/machine-id $ROOTFS/etc/resolv.conf -touch $ROOTFS/etc/machine-id $ROOTFS/etc/resolv.conf cp systemd/* $ROOTFS/etc/systemd/system/ sudo systemd-nspawn --bind=$PWD/scripts/install.sh:/root/install.sh -D $ROOTFS/ /bin/sh /root/install.sh diff --git a/alpine/rust/build.sh b/alpine/rust/build.sh deleted file mode 100644 index 212fc6a..0000000 --- a/alpine/rust/build.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/sh - -ROOTFS=/tmp/cgit -ALPINE_TARBALL=alpine-minirootfs-3.9.2-x86_64.tar.gz - -# wget http://dl-cdn.alpinelinux.org/alpine/v3.9/releases/x86_64/$ALPINE_TARBALL - -mkdir -p $ROOTFS -tar xf $ALPINE_TARBALL -C $ROOTFS/ \ - ./etc/apk ./etc/os-release ./usr ./lib ./bin ./sbin ./var - -mkdir -p $ROOTFS/etc/systemd/system \ - $ROOTFS/var/{lib,run,tmp} \ - $ROOTFS/{dev,tmp,proc,root,run,sys} \ - $ROOTFS/etc/git \ - $ROOTFS/var/lib/git -touch $ROOTFS/etc/machine-id $ROOTFS/etc/resolv.conf - -sudo systemd-nspawn --directory $ROOTFS/ /sbin/apk update -sudo systemd-nspawn --directory $ROOTFS/ /sbin/apk add cgit uwsgi-cgi -cp systemd/* $ROOTFS/etc/systemd/system/ - -mksquashfs $ROOTFS/ $ROOTFS.raw diff --git a/alpine/rust/systemd/cgit.service b/alpine/rust/systemd/cgit.service deleted file mode 100644 index 6944182..0000000 --- a/alpine/rust/systemd/cgit.service +++ /dev/null @@ -1,12 +0,0 @@ -[Unit] -Description=cgit uwsgi service -After=network.target -Before=nginx.service -Requires=cgit.socket - -[Service] -DynamicUser=yes -User=git -Group=git -RuntimeDirectory=git -ConfigurationDirectory=git diff --git a/alpine/rust/systemd/cgit.socket b/alpine/rust/systemd/cgit.socket deleted file mode 100644 index a861d5a..0000000 --- a/alpine/rust/systemd/cgit.socket +++ /dev/null @@ -1,10 +0,0 @@ -[Unit] -Description=cgit socket - -[Socket] -ListenStream=/run/git/cgit.sock -SocketMode=0660 -SocketGroup=http - -[Install] -WantedBy=sockets.target diff --git a/alpine/simple/build.sh b/alpine/simple/build.sh index c9d87ae..ac914f2 100644 --- a/alpine/simple/build.sh +++ b/alpine/simple/build.sh @@ -1,24 +1,27 @@ -#!/bin/sh +#! /bin/sh ROOTFS=`mktemp -d rootfs.XXX -t` TMPDIR=/tmp -TARBALL=alpine-minirootfs-3.9.0-x86_64.tar.gz -URL=http://dl-cdn.alpinelinux.org/alpine/v3.9/releases/x86_64/$TARBALL +TARBALL=alpine-minirootfs-3.10.1-x86_64.tar.gz +URL=http://dl-cdn.alpinelinux.org/alpine/v3.10/releases/x86_64/$TARBALL + +# 6. undo +sudo systemctl stop simple-test +sudo portablectl detach $TMPDIR/simple.raw [ "$URL" ] && wget -c $URL -mkdir $ROOTFS - # 1. create rootfs tar xf $TARBALL -C $ROOTFS/ \ ./etc/os-release ./usr ./lib ./bin ./sbin # 2. create mount points -mkdir -p $ROOTFS/etc/systemd/system $ROOTFS/var/{lib,run,tmp} $ROOTFS/{dev,proc,sys,tmp,run,root} +chmod 755 $ROOTFS +mkdir -p $ROOTFS/etc/systemd/system $ROOTFS/{proc,sys,dev,run,tmp,var/tmp} touch $ROOTFS/etc/machine-id $ROOTFS/etc/resolv.conf # 3. simple service unit -cat < $ROOTFS/etc/systemd/system/simple.service +cat < $ROOTFS/etc/systemd/system/simple-test.service [Unit] Description=Simple portable test service @@ -33,7 +36,3 @@ mksquashfs $ROOTFS $TMPDIR/simple.raw -all-root -noappend # 5. attach and start the service sudo portablectl attach $TMPDIR/simple.raw sudo systemctl start simple-test - -# 6. undo -#sudo systemctl stop simple-test -#sudo portablectl detach $TMPDIR/simple.raw