12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- #!/bin/bash
- Install_Caddy() {
- pushd ${oneinstack_dir}/src > /dev/null
- id -g ${run_group} >/dev/null 2>&1
- [ $? -ne 0 ] && groupadd ${run_group}
- id -u ${run_user} >/dev/null 2>&1
- [ $? -ne 0 ] && useradd -g ${run_group} -M -s /sbin/nologin ${run_user}
-
- tar xzf caddy-${caddy_ver}.tar.gz
-
- [ ! -d "${caddy_install_dir}/bin" ] && mkdir -p ${caddy_install_dir}/bin
- /bin/cp caddy ${caddy_install_dir}/bin
- chmod +x ${caddy_install_dir}/bin/caddy
- [ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=${caddy_install_dir}/bin:\$PATH" >> /etc/profile
- [ -n "`grep ^'export PATH=' /etc/profile`" -a -z "`grep ${caddy_install_dir} /etc/profile`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=${caddy_install_dir}/bin:\1@" /etc/profile
- . /etc/profile
-
-
-
- [ ! -d "${caddy_install_dir}/conf" ] && mkdir -p ${caddy_install_dir}/conf
- /bin/cp ../config/Caddyfile ${caddy_install_dir}/conf/
-
- /bin/cp ../init.d/caddy.service /lib/systemd/system/
-
- sed -i "s@/usr/local/caddy@${caddy_install_dir}@g" /lib/systemd/system/caddy.service
-
- systemctl enable caddy
-
- systemctl daemon-reload
-
- systemctl start caddy
- echo "${CSUCCESS}Caddy installed successfully! ${CEND}"
- }
|