Update gitea and remove rust (fake)
This commit is contained in:
parent
5cdb3e5c40
commit
e06e93736a
7 changed files with 30 additions and 81 deletions
|
@ -1,40 +1,38 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
[ -z $ROOTFS ] && ROOTFS=/tmp/gitea
|
[ -z $ROOTFS ] && ROOTFS=/tmp/gitea
|
||||||
[ -z $ALPINE_VERSION ] && ALPINE_VERSION=3.10
|
[ -z $ALPINE_VERSION ] && ALPINE_VERSION=3.10
|
||||||
[ -z $ALPINE_RELEASE ] && ALPINE_RELEASE=0
|
[ -z $ALPINE_RELEASE ] && ALPINE_RELEASE=0
|
||||||
|
|
||||||
ALPINE_TARBALL=alpine-minirootfs-$ALPINE_VERSION.$ALPINE_RELEASE-x86_64.tar.gz
|
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
|
[ -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
|
mkdir -p $ROOTFS
|
||||||
sudo tar xf $ALPINE_TARBALL -C $ROOTFS/
|
tar xf $ALPINE_TARBALL -C $ROOTFS/
|
||||||
|
|
||||||
sudo mkdir -p \
|
chmod 755 $ROOTFS
|
||||||
|
|
||||||
|
mkdir -p \
|
||||||
$ROOTFS/etc/systemd/system \
|
$ROOTFS/etc/systemd/system \
|
||||||
$ROOTFS/var/{lib,run,tmp} \
|
|
||||||
$ROOTFS/{dev,tmp,proc,root,run,sys} \
|
|
||||||
$ROOTFS/etc/gitea \
|
$ROOTFS/etc/gitea \
|
||||||
$ROOTFS/var/lib/gitea \
|
$ROOTFS/var/lib/gitea \
|
||||||
$ROOTFS/dev/log \
|
$ROOTFS/run/gitea \
|
||||||
$ROOTFS/run/systemd/journal \
|
|
||||||
$ROOTFS/run/{dbus,gitea} \
|
|
||||||
$ROOTFS/{proc,sys,dev} \
|
|
||||||
$ROOTFS/var/tmp/ \
|
|
||||||
$ROOTFS/root/.ssh
|
$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 update
|
||||||
sudo systemd-nspawn --directory $ROOTFS/ /sbin/apk add --no-cache gitea openssh-keygen
|
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
|
rm -f $ROOTFS.raw
|
||||||
#sudo rm -rf $ROOTFS
|
mksquashfs $ROOTFS/ $ROOTFS.raw -all-root -noappend
|
||||||
sudo portablectl attach $ROOTFS.raw
|
sudo portablectl attach $ROOTFS.raw
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=Gitea (Git with a cup of tea)
|
Description=Gitea (Git with a cup of tea)
|
||||||
After=network.target
|
After=network.target
|
||||||
|
#Requires=sshd.socket
|
||||||
|
|
||||||
#Requires=mysql.service
|
#Requires=mysql.service
|
||||||
#Requires=mariadb.service
|
#Requires=mariadb.service
|
||||||
#Requires=postgresql.service
|
#Requires=postgresql.service
|
||||||
|
@ -8,17 +10,13 @@ After=network.target
|
||||||
#Requires=redis.service
|
#Requires=redis.service
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=simple
|
User=git
|
||||||
User=gitea
|
|
||||||
Group=www-data
|
Group=www-data
|
||||||
|
|
||||||
Environment=USER=gitea HOME=/var/lib/gitea GITEA_WORK_DIR=/var/lib/gitea
|
|
||||||
WorkingDirectory=/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
|
StateDirectory=gitea
|
||||||
ConfigurationDirectory=gitea
|
ConfigurationDirectory=gitea
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,6 @@ mkdir -p \
|
||||||
|
|
||||||
touch $ROOTFS/etc/machine-id $ROOTFS/etc/resolv.conf
|
touch $ROOTFS/etc/machine-id $ROOTFS/etc/resolv.conf
|
||||||
|
|
||||||
touch $ROOTFS/etc/machine-id $ROOTFS/etc/resolv.conf
|
|
||||||
cp systemd/* $ROOTFS/etc/systemd/system/
|
cp systemd/* $ROOTFS/etc/systemd/system/
|
||||||
|
|
||||||
sudo systemd-nspawn --bind=$PWD/scripts/install.sh:/root/install.sh -D $ROOTFS/ /bin/sh /root/install.sh
|
sudo systemd-nspawn --bind=$PWD/scripts/install.sh:/root/install.sh -D $ROOTFS/ /bin/sh /root/install.sh
|
||||||
|
|
|
@ -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
|
|
|
@ -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
|
|
|
@ -1,10 +0,0 @@
|
||||||
[Unit]
|
|
||||||
Description=cgit socket
|
|
||||||
|
|
||||||
[Socket]
|
|
||||||
ListenStream=/run/git/cgit.sock
|
|
||||||
SocketMode=0660
|
|
||||||
SocketGroup=http
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=sockets.target
|
|
|
@ -1,24 +1,27 @@
|
||||||
#!/bin/sh
|
#! /bin/sh
|
||||||
|
|
||||||
ROOTFS=`mktemp -d rootfs.XXX -t`
|
ROOTFS=`mktemp -d rootfs.XXX -t`
|
||||||
TMPDIR=/tmp
|
TMPDIR=/tmp
|
||||||
TARBALL=alpine-minirootfs-3.9.0-x86_64.tar.gz
|
TARBALL=alpine-minirootfs-3.10.1-x86_64.tar.gz
|
||||||
URL=http://dl-cdn.alpinelinux.org/alpine/v3.9/releases/x86_64/$TARBALL
|
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
|
[ "$URL" ] && wget -c $URL
|
||||||
|
|
||||||
mkdir $ROOTFS
|
|
||||||
|
|
||||||
# 1. create rootfs
|
# 1. create rootfs
|
||||||
tar xf $TARBALL -C $ROOTFS/ \
|
tar xf $TARBALL -C $ROOTFS/ \
|
||||||
./etc/os-release ./usr ./lib ./bin ./sbin
|
./etc/os-release ./usr ./lib ./bin ./sbin
|
||||||
|
|
||||||
# 2. create mount points
|
# 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
|
touch $ROOTFS/etc/machine-id $ROOTFS/etc/resolv.conf
|
||||||
|
|
||||||
# 3. simple service unit
|
# 3. simple service unit
|
||||||
cat <<EOF > $ROOTFS/etc/systemd/system/simple.service
|
cat <<EOF > $ROOTFS/etc/systemd/system/simple-test.service
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=Simple portable test service
|
Description=Simple portable test service
|
||||||
|
|
||||||
|
@ -33,7 +36,3 @@ mksquashfs $ROOTFS $TMPDIR/simple.raw -all-root -noappend
|
||||||
# 5. attach and start the service
|
# 5. attach and start the service
|
||||||
sudo portablectl attach $TMPDIR/simple.raw
|
sudo portablectl attach $TMPDIR/simple.raw
|
||||||
sudo systemctl start simple-test
|
sudo systemctl start simple-test
|
||||||
|
|
||||||
# 6. undo
|
|
||||||
#sudo systemctl stop simple-test
|
|
||||||
#sudo portablectl detach $TMPDIR/simple.raw
|
|
||||||
|
|
Loading…
Reference in a new issue