1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/fider_ynh.git synced 2024-09-03 18:36:11 +02:00
fider_ynh/scripts/_common.sh

47 lines
1.5 KiB
Bash
Raw Normal View History

2017-06-05 13:04:03 +02:00
#!/bin/bash
2019-02-10 15:02:38 +01:00
#=================================================
2019-03-05 23:17:15 +01:00
# COMMON VARIABLES
2019-02-10 15:02:38 +01:00
#=================================================
2022-10-06 14:42:19 +02:00
2024-06-19 14:32:15 +02:00
nodejs_version=18
2024-09-02 14:46:21 +02:00
go_version=1.22.0
2019-03-05 23:11:52 +01:00
2019-03-05 23:17:15 +01:00
#=================================================
# PERSONAL HELPERS
#=================================================
2022-10-06 14:42:19 +02:00
build_fider() {
2023-06-09 21:48:46 +02:00
ynh_exec_as "$app" mkdir -p "$install_dir/go_build"
ynh_secure_remove -f "$install_dir/app"
mkdir -p "$install_dir/app"
2022-10-06 14:42:19 +02:00
2023-06-09 21:48:46 +02:00
pushd "$install_dir/sources" || ynh_die --message "Could not move into $install_dir/sources!"
2022-10-06 14:42:19 +02:00
# Build server
ynh_exec_as "$app" \
2023-06-09 21:48:46 +02:00
GOPATH="$install_dir/go_build/go" \
GOCACHE="$install_dir/go_build/.cache" \
2022-10-06 14:42:19 +02:00
GOOS=linux GOARCH="$(dpkg --print-architecture)" \
2023-06-09 21:48:46 +02:00
"PATH=/usr/lib/go-1.18/bin:$PATH" \
2022-10-06 14:42:19 +02:00
make build-server
2023-06-09 21:48:46 +02:00
cp -R migrations views locale LICENSE fider "$install_dir/app"
2022-10-06 14:42:19 +02:00
# Build UI
ynh_use_nodejs
ynh_exec_as "$app" $ynh_node_load_PATH $ynh_npm ci
ynh_exec_as "$app" $ynh_node_load_PATH make build-ssr
ynh_exec_as "$app" $ynh_node_load_PATH make build-ui
2023-06-09 21:48:46 +02:00
cp -R favicon.png dist robots.txt ssr.js "$install_dir/app"
popd || ynh_die
chown "$app:www-data" -R "$install_dir/app"
2024-05-14 08:44:03 +02:00
ynh_remove_go
2022-10-06 14:42:19 +02:00
}
2019-02-10 15:02:38 +01:00
#=================================================
# EXPERIMENTAL HELPERS
#=================================================
2023-06-10 17:43:10 +02:00
#=================================================
# FUTURE OFFICIAL HELPERS
#=================================================