agate

Simple gemini server for static files
git clone https://github.com/mbrubeck/agate.git
Log | Files | Refs | README

install.sh (2000B)


      1 #!/bin/bash
      2 # This file is part of the Agate software and licensed under either the
      3 # MIT license or Apache license at your option.
      4 #
      5 # Please keep in mind that there is not warranty whatsoever provided for this
      6 # software as specified in the disclaimer in the MIT license or section 7 of
      7 # the Apache license respectively.
      8 
      9 echo -n "checking:agate......."
     10 if command -v agate >/dev/null
     11 then
     12 	echo "found"
     13 else
     14 	echo "FAILED"
     15 	echo "Agate is probably not in your PATH variable."
     16 	echo "If you installed it with cargo, try linking the binary to /usr/local/bin with something like this:"
     17 	echo "    ln -s $HOME/.cargo/bin/agate /usr/local/bin/agate"
     18 	echo "or what seems reasonable to you."
     19 	exit 1
     20 fi
     21 
     22 echo -n "checking:systemd....."
     23 if [[ "$(cat /proc/1/comm)" != "systemd" ]]
     24 then
     25 	echo "NOT THE INIT PROCESS"
     26 	echo "Your system seems to not use systemd, sorry. Aborting."
     27 	exit 1
     28 else
     29 	echo "installed and running"
     30 fi
     31 
     32 echo -n "checking:rsyslogd...."
     33 if command -v rsyslogd >/dev/null
     34 then
     35 	echo -n "installed"
     36 	if ps cax | grep -q "rsyslogd"
     37 	then
     38 		echo " and running"
     39 	else
     40 		echo " but not running!"
     41 		echo "You should enable rsyslogd to use this functionality."
     42 	fi
     43 else
     44 	echo "NOT INSTALLED!"
     45 	echo "Aborting."
     46 	exit 1
     47 fi
     48 
     49 echo -n "checking:logrotate..."
     50 if type logrotate >/dev/null 2>&1
     51 then
     52 	echo "installed, but I cannot check if it is enabled"
     53 else
     54 	echo "NOT INSTALLED!"
     55 	echo "Aborting."
     56 	exit 1
     57 fi
     58 
     59 # immediately exit if one of the following commands fails
     60 set -e
     61 
     62 echo "copying config files..."
     63 cp gemini.service /etc/systemd/system/
     64 cp gemini.conf /etc/rsyslog.d/
     65 cp geminilogs /etc/logrotate.d/
     66 
     67 echo "setting up content files..."
     68 mkdir -p /srv/gemini/content
     69 mkdir -p /srv/gemini/.certificates
     70 # agate will generate certificates on first run
     71 
     72 echo "starting service..."
     73 systemctl daemon-reload
     74 systemctl restart rsyslog
     75 systemctl enable gemini
     76 systemctl start gemini
     77 
     78 echo "setup done, checking..."
     79 # wait until the restarts would have timed out
     80 sleep 10
     81 systemctl status gemini