mirror of
https://github.com/yacy/yacy_search_server.git
synced 2024-09-19 00:01:41 +02:00
Added Snap package configuration to choose to version data or not
By default when the Snap package is installed, YaCy data is stored in a versioned user folder, allowing to revert to previous data after a package refresh for example. But it can consumes much disk space, so it is now possible to tell YaCy snap not to version its data, with the Snap configuration setting "data.versioned=false".
This commit is contained in:
parent
811d40a6c4
commit
915080e8d4
16
addon/snap/snapPasswd.sh
Executable file
16
addon/snap/snapPasswd.sh
Executable file
|
@ -0,0 +1,16 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
# Wrapper script for Snap package specific instructions before calling the bin/passwd.sh script
|
||||||
|
|
||||||
|
# Check the snap configuration to properly fill the YACY_DATA_PATH environment variable
|
||||||
|
DATA_VERSIONED="$(snapctl get data.versioned)"
|
||||||
|
if [ "$DATA_VERSIONED" = "false" ]; then
|
||||||
|
# YaCy data is in the Snap common (non versioned) user data
|
||||||
|
YACY_DATA_PATH="$SNAP_USER_COMMON/DATA"
|
||||||
|
else
|
||||||
|
# Defaults : YaCy data is in the Snap versioned user data
|
||||||
|
YACY_DATA_PATH="$SNAP_USER_DATA/DATA"
|
||||||
|
fi
|
||||||
|
export YACY_DATA_PATH
|
||||||
|
|
||||||
|
sh "$SNAP/yacy/bin/passwd.sh"
|
45
addon/snap/snapStartYACY.sh
Executable file
45
addon/snap/snapStartYACY.sh
Executable file
|
@ -0,0 +1,45 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
# Wrapper script for Snap package specific instructions before calling the startYACY.sh script
|
||||||
|
|
||||||
|
# Check the snap configuration to properly fill the YACY_DATA_PATH environment variable
|
||||||
|
echo "*******************************************************************************"
|
||||||
|
DATA_VERSIONED="$(snapctl get data.versioned)"
|
||||||
|
if [ "$DATA_VERSIONED" = "false" ]; then
|
||||||
|
# YaCy data is in the Snap common (non versioned) user data
|
||||||
|
YACY_PARENT_DATA_PATH="$SNAP_USER_COMMON"
|
||||||
|
|
||||||
|
if [ ! -d "$YACY_PARENT_DATA_PATH/DATA" ] && [ -d "$SNAP_USER_DATA/DATA" ]; then
|
||||||
|
if [ -f "$SNAP_USER_DATA/DATA/yacy.running" ]; then
|
||||||
|
echo "**** Warning : can not move YaCy snap data from versioned to non versioned folder as YaCy appears to be already running."
|
||||||
|
else
|
||||||
|
(mv "$SNAP_USER_DATA/DATA" "$YACY_PARENT_DATA_PATH" && \
|
||||||
|
echo "*** YaCy snap data moved from versioned to non versioned snap data." ) \
|
||||||
|
|| echo "**** Warning : could not move YaCy snap data from versioned to non versioned folder."
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "** YaCy snap is using non versioned data at $YACY_PARENT_DATA_PATH/DATA"
|
||||||
|
echo "** You can configure it to use snap versioned data with the following command :"
|
||||||
|
echo "** sudo snap set $SNAP_NAME data.versioned=true"
|
||||||
|
else
|
||||||
|
# Defaults : YaCy data is in the Snap versioned user data
|
||||||
|
YACY_PARENT_DATA_PATH="$SNAP_USER_DATA"
|
||||||
|
|
||||||
|
if [ ! -d "$YACY_PARENT_DATA_PATH/DATA" ] && [ -d "$SNAP_USER_COMMON/DATA" ]; then
|
||||||
|
if [ -f "$SNAP_USER_COMMON/DATA/yacy.running" ]; then
|
||||||
|
echo "**** Warning : can not move YaCy snap data from non versioned to versioned folder as YaCy appears to be already running."
|
||||||
|
else
|
||||||
|
(mv "$SNAP_USER_COMMON/DATA" "$YACY_PARENT_DATA_PATH" && \
|
||||||
|
echo "*** YaCy snap data moved from non versioned to versioned snap data." ) \
|
||||||
|
|| echo "**** Warning : could not move YaCy snap data from non versioned to versioned folder."
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "** YaCy snap is using versioned data at $YACY_PARENT_DATA_PATH/DATA"
|
||||||
|
echo "** To reduce disk usage, you can configure it to use snap non versioned data with the following command :"
|
||||||
|
echo "** sudo snap set $SNAP_NAME data.versioned=false"
|
||||||
|
fi
|
||||||
|
export YACY_PARENT_DATA_PATH
|
||||||
|
|
||||||
|
sh "$SNAP/yacy/startYACY.sh" -f -s "$YACY_PARENT_DATA_PATH"
|
6
snap/hooks/configure
vendored
Executable file
6
snap/hooks/configure
vendored
Executable file
|
@ -0,0 +1,6 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
# Snap configuration hook script
|
||||||
|
# Even if empty, its presence is required to enable the Snap specific "data.versioned" configuration key
|
||||||
|
|
||||||
|
echo "Configuring yacy-search"
|
|
@ -19,7 +19,7 @@ apps:
|
||||||
# needed to run wkhtmltopdf from YaCy within the Snap for Snapshots generation
|
# needed to run wkhtmltopdf from YaCy within the Snap for Snapshots generation
|
||||||
# with wkhtmltopdf 0.12.2.4 included with Ubuntu 16.04 LTS (recommended minimum system to build Snaps in 2018)
|
# with wkhtmltopdf 0.12.2.4 included with Ubuntu 16.04 LTS (recommended minimum system to build Snaps in 2018)
|
||||||
QT_QPA_PLATFORM_PLUGIN_PATH: "$SNAP/usr/lib/x86_64-linux-gnu/qt5/plugins/platforms"
|
QT_QPA_PLATFORM_PLUGIN_PATH: "$SNAP/usr/lib/x86_64-linux-gnu/qt5/plugins/platforms"
|
||||||
command: sh "$SNAP/yacy/startYACY.sh" -f -s "$SNAP_USER_DATA"
|
command: sh "$SNAP/yacy/addon/snap/snapStartYACY.sh"
|
||||||
# Interfaces authorizations requirements
|
# Interfaces authorizations requirements
|
||||||
# network-bind - to allow acting as an HTTP server and client
|
# network-bind - to allow acting as an HTTP server and client
|
||||||
# desktop - to launch the default desktop navigator when starting (with xdg-open command) - not strictly necessary
|
# desktop - to launch the default desktop navigator when starting (with xdg-open command) - not strictly necessary
|
||||||
|
@ -29,9 +29,7 @@ apps:
|
||||||
# x11 - needed by wkhtmltopdf to generate Snapshots using WebKit engine - not necessary when Snapshots feature is not used
|
# x11 - needed by wkhtmltopdf to generate Snapshots using WebKit engine - not necessary when Snapshots feature is not used
|
||||||
plugs: [network-bind, desktop, home, x11]
|
plugs: [network-bind, desktop, home, x11]
|
||||||
passwd: # set the YaCy administrator password
|
passwd: # set the YaCy administrator password
|
||||||
environment:
|
command: sh "$SNAP/yacy/addon/snap/snapPasswd.sh"
|
||||||
YACY_DATA_PATH: "$SNAP_USER_DATA/DATA"
|
|
||||||
command: sh "$SNAP/yacy/bin/passwd.sh"
|
|
||||||
# Interfaces authorizations requirements
|
# Interfaces authorizations requirements
|
||||||
# network - to allow requesting the ConfigAccounts_p HTTP API when the server is running
|
# network - to allow requesting the ConfigAccounts_p HTTP API when the server is running
|
||||||
plugs: [network]
|
plugs: [network]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user