1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/dendrite_ynh.git synced 2024-09-03 18:25:58 +02:00

More clean install

This commit is contained in:
yalh76 2022-03-19 15:28:40 +01:00
parent 7ec59f4c86
commit d6bdad1c90
2 changed files with 29 additions and 13 deletions

View file

@ -100,7 +100,7 @@ ynh_script_progression --message="Setting up source files..." --weight=2
ynh_app_setting_set --app=$app --key=final_path --value=$final_path ynh_app_setting_set --app=$app --key=final_path --value=$final_path
# Download, check integrity, uncompress and patch the source from app.src # Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$final_path" ynh_setup_source --dest_dir="$final_path/build"
chmod 750 "$final_path" chmod 750 "$final_path"
chmod -R o-rwx "$final_path" chmod -R o-rwx "$final_path"
@ -123,22 +123,25 @@ ynh_script_progression --message="Building the sources (it will take some time).
ynh_install_go --go_version=$GO_VERSION ynh_install_go --go_version=$GO_VERSION
pushd "$final_path" pushd "$final_path/build"
ynh_use_go
# Build the sources # Build the sources
mkdir ./bin ynh_use_go
ynh_exec_warn_less ./build.sh CGO_ENABLED=1 go build -trimpath -v -o "$final_path/bin/" ./cmd/...
CGO_ENABLED=0 GOOS=js GOARCH=wasm go build -trimpath -o "$final_path/bin/main.wasm" ./cmd/dendritejs-pinecone
popd
ynh_script_progression --message="Generating the keys..." --weight=1 ynh_secure_remove --file="$final_path/build"
ynh_remove_go
ynh_script_progression --message="Generating the keys..." --weight=1
pushd "$final_path"
# Generate a Matrix signing key for federation # Generate a Matrix signing key for federation
./bin/generate-keys --private-key matrix_key.pem ./bin/generate-keys --private-key matrix_key.pem
# Generate a self-signed certificate # Generate a self-signed certificate
./bin/generate-keys --tls-cert server.crt --tls-key server.key ./bin/generate-keys --tls-cert server.crt --tls-key server.key
popd popd
ynh_remove_go
# Set permissions to app files # Set permissions to app files
chown -R $app:root "$final_path" chown -R $app:root "$final_path"

View file

@ -81,7 +81,7 @@ then
ynh_script_progression --message="Upgrading source files..." --weight=3 ynh_script_progression --message="Upgrading source files..." --weight=3
# Download, check integrity, uncompress and patch the source from app.src # Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$final_path" --keep="$final_path/dendrite.yaml" ynh_setup_source --dest_dir="$final_path/build" --keep="$final_path/dendrite.yaml"
fi fi
chmod 750 "$final_path" chmod 750 "$final_path"
@ -114,17 +114,30 @@ then
ynh_script_progression --message="Building the sources (it will take some time)..." --weight=6 ynh_script_progression --message="Building the sources (it will take some time)..." --weight=6
ynh_install_go --go_version=$GO_VERSION ynh_install_go --go_version=$GO_VERSION
pushd "$final_path"
ynh_use_go pushd "$final_path/build"
# Build the sources # Build the sources
ynh_exec_warn_less ./build.sh ynh_use_go
CGO_ENABLED=1 go build -trimpath -v -o "$final_path/bin/" ./cmd/...
CGO_ENABLED=0 GOOS=js GOARCH=wasm go build -trimpath -o "$final_path/bin/main.wasm" ./cmd/dendritejs-pinecone
popd popd
ynh_secure_remove --file="$final_path/build"
ynh_remove_go ynh_remove_go
fi fi
chown -R $app:root "$final_path" chown -R $app:root "$final_path"
#=================================================
# UPDATE A CONFIG FILE
#=================================================
ynh_script_progression --message="Updating a configuration file..."
ynh_add_config --template="../conf/dendrite.yaml" --destination="$final_path/dendrite.yaml"
chmod 400 "$final_path/dendrite.yaml"
chown $app:$app "$final_path/dendrite.yaml"
#================================================= #=================================================
# SETUP SYSTEMD # SETUP SYSTEMD
#================================================= #=================================================