This repository has been archived by the owner on Dec 3, 2019. It is now read-only.
/
installer.sh
174 lines (139 loc) · 6.13 KB
/
installer.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
#!/bin/bash
#[ "$UID" -eq 0 ] || exec sudo bash "$0" "$@" #if we decide superuser execution
# Define a timestamp function
timestamp() {
date +"%d%m%y_%H%M" #FORMAT DayMonthYear_HoursMinutes
}
WORKING_DIR="$(pwd)"
UNOPKG_PATH="$(which unopkg)"
LIBRECUST_MACRO_PATH="$(realpath ../)/menu_customization/macros/LibreCustLib.oxt"
SETTINGS_LOADER_PATH="$(realpath ../)/settings_loader/settings_loader.oxt"
PAGE_NUMBERING_PATH="$(realpath ../)/page_numbering_addon/LibreOffice/python/build_files/PageNumberingAddonPython-0.0.1.oxt"
AUTOTEXT_PATH="$(realpath ../)/autotext_addon/LibreOffice/sidebar_version/build_files/AutotextAddon-0.0.1.oxt"
LAWADDON_PATH="$(realpath ../)/law_addon/LibreOffice/build_files/LawAddon-0.0.1.oxt"
MENUBAR_PATH="$(realpath ../)/menu_customization/menubar/menubar.xml"
TOOLBAR_PATH="$(realpath ../)/menu_customization/toolbar"
USER_HOME_PATH="$(eval echo "~$different_user")"
USER_PROFILE_PATH="$USER_HOME_PATH/.config/libreoffice/4/user/config/"
ICON_THEME_PATH="$TOOLBAR_PATH/icon_theme"
LIBRE_LIB_CONFIG_PATH="/usr/lib/libreoffice/share/config/"
INSTALLATION_TIMESTAMP="$(timestamp)"
echo "▌ ▗ ▌ ▌
▌ ▄ ▛▀▖▙▀▖▞▀▖▌ ▝▀▖▌ ▌
▌ ▐ ▌ ▌▌ ▛▀ ▌ ▞▀▌▐▐▐
▀▀▘▀▘▀▀ ▘ ▝▀▘▀▀▘▝▀▘ ▘▘"
echo "LibreLaw project install client"
echo "In order to install LibreLaw, all instances of Libreoffice should be terminated"
echo "Please save your active documents before proceeding with the LibreOffice process termination"
read -p "Terminate LibreOffice? [y/n] " -n 1 -r
echo # (optional) move to a new line
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
echo "Installation Failed: exiting"
exit 1
fi
killall soffice.bin
#--------------------------------------------------------------------------------
# Librecust macro library
#--------------------------------------------------------------------------------
read -p "Install macro library (Librecust.oxt)? [y/n] " -n 1 -r
echo # (optional) move to a new line
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
echo "Installation Failed: exiting"
exit 1
fi
eval $UNOPKG_PATH gui $LIBRECUST_MACRO_PATH
#--------------------------------------------------------------------------------
# Settings Loader
#--------------------------------------------------------------------------------
read -p "Install Settings Loader (settings_loader.oxt)? [y/n] " -n 1 -r
echo # (optional) move to a new line
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
echo "Installation Failed: exiting"
exit 1
fi
eval $UNOPKG_PATH gui $SETTINGS_LOADER_PATH
#--------------------------------------------------------------------------------
# Page Numbering
#--------------------------------------------------------------------------------
read -p "Install Page Numbering Addon (PageNumberingAddon.oxt)? [y/n] " -n 1 -r
echo # (optional) move to a new line
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
echo "Installation Failed: exiting"
exit 1
fi
eval $UNOPKG_PATH gui $PAGE_NUMBERING_PATH
#--------------------------------------------------------------------------------
# AutoText Addon
#--------------------------------------------------------------------------------
read -p "Install AutoText Addon (AutoTextAddon.oxt)? [y/n] " -n 1 -r
echo # (optional) move to a new line
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
echo "Installation Failed: exiting"
exit 1
fi
eval $UNOPKG_PATH gui $AUTOTEXT_PATH #unopkg gui because it is licensed and unopkg crashes when used with such extensions
#--------------------------------------------------------------------------------
# Law Addon
#--------------------------------------------------------------------------------
read -p "Install Law Toolbar (LawAddon.oxt)? [y/n] " -n 1 -r
echo # (optional) move to a new line
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
echo "Installation Failed: exiting"
exit 1
fi
eval $UNOPKG_PATH gui $LAWADDON_PATH #unopkg gui because it is licensed and unopkg crashes when used with such extensions
#--------------------------------------------------------------------------------
# Menu Bar
#--------------------------------------------------------------------------------
#Then we have to copy menubar after we backup previous menubar configuration with timestamp
read -p "Install Modified menubar (menubar.xml)? [y/n] " -n 1 -r
echo # (optional) move to a new line
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
echo "Installation Failed: exiting"
exit 1
fi
# Backup current configuration and name it using timestamp for future reference
cd "$USER_PROFILE_PATH/soffice.cfg/modules/swriter/menubar/"
cp ./menubar.xml "./menubar.xml.bak_$INSTALLATION_TIMESTAMP"
# Copy customized menubar.xml
cp $MENUBAR_PATH ./menubar.xml
cd $WORKING_DIR #return to installer.sh path
#--------------------------------------------------------------------------------
# Toolbar
#--------------------------------------------------------------------------------
#Then we have to copy toolbars while backing up previous config
read -p "Install Modified toolbars (toolbar/*.xml)? [y/n] " -n 1 -r
echo # (optional) move to a new line
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
echo "Installation Failed: exiting"
exit 1
fi
# Backup current configuration and name it using timestamp for future reference
cd "$USER_PROFILE_PATH/soffice.cfg/modules/swriter/toolbar/"
mkdir "toolbar_bak_$INSTALLATION_TIMESTAMP"
cp ./*.xml "./toolbar_bak_$INSTALLATION_TIMESTAMP/"
# Copy customized toolbars to User Profile
cp "$TOOLBAR_PATH"/*.xml ./
#--------------------------------------------------------------------------------
# Icon theme
#--------------------------------------------------------------------------------
#Install icon theme (LibreOffice 5 needs the .zip file copied to install_dir. Version 6 allows bundling an icon theme in extension format)
read -p "Install Office 2013 icon theme by charliecnr (toolbar/icon_theme/)? [y/n] " -n 1 -r
echo # (optional) move to a new line
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
echo "Installation Failed: exiting"
exit 1
fi
# Copy icon theme
sudo cp "$ICON_THEME_PATH"/*.zip $LIBRE_LIB_CONFIG_PATH
#Then we have to create desired file structure and copy templates
#Finaly we have to install the main Librelaw oxt extension