更换了一台arm64的设备做低功耗服务器7x24待命,顺手写个脚本部署Gogs备用。
脚本需要sudo运行。暂不支持自动判断架构,后续可能会更新,思路是uname -m正则匹配。

#!/bin/bash
[[ $(id -u) != 0 ]] && echo "Pls run with sudo" && exit -1

# set gogs url modify if needed
URL=https://dl.gogs.io/0.12.3/gogs_0.12.3_linux_armv8.tar.gz

# download gogs and create git user
wget $URL -O /dev/shm/gogs.tgz
adduser --disabled-login --gecos 'Gogs' git
sudo -u git tar zxvf /dev/shm/gogs.tgz -C /home/git
rm /dev/shm/gogs.tgz

# create system service
echo "[Unit]
Description=Gogs
After=syslog.target
After=network.target

[Service]
RestartSec=2s
Type=simple
User=git
Group=git
WorkingDirectory=/home/git/gogs
ExecStart=/home/git/gogs/gogs web
Restart=always
Environment=USER=git
HOME=/home/git

[Install]
WantedBy=multi-user.target
" > /etc/systemd/system/gogs.service

# launch with startup
systemctl daemon-reload
systemctl enable gogs
systemctl start gogs

echo "DONE!"

相关文章:

  • 2022-02-07
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-04-25
  • 2021-05-21
  • 2022-02-17
  • 2021-08-16
  • 2022-01-20
  • 2021-06-28
  • 2022-02-16
相关资源
相似解决方案