fix http get vs rsync
This commit is contained in:
parent
873d53f9a2
commit
0228723bba
67
install.sh
67
install.sh
|
@ -24,20 +24,39 @@ sudo_cmd=""
|
||||||
|
|
||||||
# See https://git.daplie.com/Daplie/daplie-snippets/blob/master/bash/http-get.sh
|
# See https://git.daplie.com/Daplie/daplie-snippets/blob/master/bash/http-get.sh
|
||||||
|
|
||||||
http_get=""
|
http_curl_opts="-fsSL"
|
||||||
|
http_wget_opts="--quiet"
|
||||||
|
|
||||||
|
http_bin=""
|
||||||
http_opts=""
|
http_opts=""
|
||||||
http_out=""
|
http_out=""
|
||||||
|
|
||||||
detect_http_get()
|
detect_http_bin()
|
||||||
{
|
{
|
||||||
if type -p curl >/dev/null 2>&1; then
|
if type -p curl >/dev/null 2>&1; then
|
||||||
http_get="curl"
|
http_bin="curl"
|
||||||
http_opts="-fsSL"
|
http_opts="$http_curl_opts"
|
||||||
http_out="-o"
|
http_out="-o"
|
||||||
|
#curl -fsSL "$url" -o "$PREFIX/tmp/$pkg"
|
||||||
elif type -p wget >/dev/null 2>&1; then
|
elif type -p wget >/dev/null 2>&1; then
|
||||||
http_get="wget"
|
http_bin="wget"
|
||||||
http_opts="--quiet"
|
http_opts="$http_wget_opts"
|
||||||
http_out="-O"
|
http_out="-O"
|
||||||
|
#wget --quiet "$url" -O "$PREFIX/tmp/$pkg"
|
||||||
|
else
|
||||||
|
echo "Aborted, could not find curl or wget"
|
||||||
|
return 7
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
http_get()
|
||||||
|
{
|
||||||
|
if [ -e "$1" ]; then
|
||||||
|
rsync -a "$1" "$2"
|
||||||
|
elif type -p curl >/dev/null 2>&1; then
|
||||||
|
$http_bin $http_curl_opts $http_out "$2" "$1"
|
||||||
|
elif type -p wget >/dev/null 2>&1; then
|
||||||
|
$http_bin $http_wget_opts $http_out "$2" "$1"
|
||||||
else
|
else
|
||||||
echo "Aborted, could not find curl or wget"
|
echo "Aborted, could not find curl or wget"
|
||||||
return 7
|
return 7
|
||||||
|
@ -46,7 +65,7 @@ detect_http_get()
|
||||||
|
|
||||||
dap_dl()
|
dap_dl()
|
||||||
{
|
{
|
||||||
$http_get $http_opts $http_out "$2" "$1"
|
http_get "$1" "$2"
|
||||||
}
|
}
|
||||||
|
|
||||||
dap_dl_bash()
|
dap_dl_bash()
|
||||||
|
@ -54,10 +73,10 @@ dap_dl_bash()
|
||||||
dap_url=$1
|
dap_url=$1
|
||||||
#dap_args=$2
|
#dap_args=$2
|
||||||
rm -rf dap-tmp-runner.sh
|
rm -rf dap-tmp-runner.sh
|
||||||
$http_get $http_opts $http_out dap-tmp-runner.sh "$dap_url"; bash dap-tmp-runner.sh; rm dap-tmp-runner.sh
|
$http_bin $http_opts $http_out dap-tmp-runner.sh "$dap_url"; bash dap-tmp-runner.sh; rm dap-tmp-runner.sh
|
||||||
}
|
}
|
||||||
|
|
||||||
detect_http_get
|
detect_http_bin
|
||||||
|
|
||||||
## END HTTP_GET ##
|
## END HTTP_GET ##
|
||||||
|
|
||||||
|
@ -146,6 +165,7 @@ install_service()
|
||||||
echo '(please file a bug with the output of "uname -a")'
|
echo '(please file a bug with the output of "uname -a")'
|
||||||
echo ""
|
echo ""
|
||||||
fi
|
fi
|
||||||
|
echo ""
|
||||||
}
|
}
|
||||||
|
|
||||||
## END SERVICE_INSTALL ##
|
## END SERVICE_INSTALL ##
|
||||||
|
@ -180,7 +200,8 @@ dap_dl_bash "https://git.daplie.com/coolaj86/node-install-script/raw/master/setu
|
||||||
my_app_name=walnut
|
my_app_name=walnut
|
||||||
my_app_pkg_name=com.daplie.walnut.web
|
my_app_pkg_name=com.daplie.walnut.web
|
||||||
my_app_dir=$(mktemp -d)
|
my_app_dir=$(mktemp -d)
|
||||||
installer_base="https://git.daplie.com/Daplie/walnut.js/raw/master/dist"
|
#installer_base="https://git.daplie.com/Daplie/walnut.js/raw/master/dist"
|
||||||
|
installer_base="./dist"
|
||||||
|
|
||||||
my_app_etc_config="etc/${my_app_name}/${my_app_name}.yml"
|
my_app_etc_config="etc/${my_app_name}/${my_app_name}.yml"
|
||||||
my_app_systemd_service="etc/systemd/system/${my_app_name}.service"
|
my_app_systemd_service="etc/systemd/system/${my_app_name}.service"
|
||||||
|
@ -188,20 +209,24 @@ my_app_systemd_tmpfiles="etc/tmpfiles.d/${my_app_name}.conf"
|
||||||
my_app_launchd_service="Library/LaunchDaemons/${my_app_pkg_name}.plist"
|
my_app_launchd_service="Library/LaunchDaemons/${my_app_pkg_name}.plist"
|
||||||
|
|
||||||
# Install
|
# Install
|
||||||
#git clone git@git.daplie.com:Daplie/walnut.js.git
|
install_my_app()
|
||||||
#git clone https://git.daplie.com/Daplie/walnut.js.git /srv/walnut/core
|
{
|
||||||
sudo mkdir -p /srv/walnut/{core,lib,etc,config,node_modules}
|
#git clone git@git.daplie.com:Daplie/walnut.js.git
|
||||||
rm -rf /srv/walnut/core/node_modules
|
#git clone https://git.daplie.com/Daplie/walnut.js.git /srv/walnut/core
|
||||||
ln -sf ../node_modules /srv/walnut/core/node_modules
|
sudo mkdir -p /srv/walnut/{core,lib,etc,config,node_modules}
|
||||||
sudo mkdir -p /srv/walnut/etc/org.oauth3.consumer
|
rm -rf /srv/walnut/core/node_modules
|
||||||
sudo mkdir -p /srv/walnut/etc/org.oauth3.provider
|
ln -sf ../node_modules /srv/walnut/core/node_modules
|
||||||
sudo mkdir -p /srv/walnut/packages/{api,pages,services}
|
sudo mkdir -p /srv/walnut/etc/org.oauth3.consumer
|
||||||
sudo chown -R $(whoami):$(whoami) /srv/walnut
|
sudo mkdir -p /srv/walnut/etc/org.oauth3.provider
|
||||||
|
sudo mkdir -p /srv/walnut/packages/{api,pages,services}
|
||||||
|
sudo chown -R $(whoami):$(whoami) /srv/walnut
|
||||||
|
|
||||||
pushd /srv/walnut/core
|
pushd /srv/walnut/core
|
||||||
npm install
|
npm install
|
||||||
popd
|
popd
|
||||||
|
}
|
||||||
|
|
||||||
|
install_my_app
|
||||||
create_skeleton
|
create_skeleton
|
||||||
install_uninstaller
|
install_uninstaller
|
||||||
install_service
|
install_service
|
||||||
|
|
Loading…
Reference in New Issue