alr-repo/onlyoffice-bin/alr.sh

89 lines
3.7 KiB
Bash
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

name='onlyoffice-bin'
version='8.2.0'
release='5'
desc='An office suite that combines text, spreadsheet and presentation editors'
homepage='https://www.onlyoffice.com/'
maintainer="Евгений Храмов <xpamych@yandex.ru>"
architectures=('amd64')
license=('AGPL-3.0-only')
provides=('onlyoffice')
conflicts=('onlyoffice')
deps=('curl' 'gtk3' 'alsa-lib' 'libpulse' 'gstreamer' 'gst-plugins-base-libs'
'gst-plugins-ugly' 'libxss' 'nss' 'nspr' 'ttf-dejavu' 'ttf-liberation'
'ttf-carlito' 'desktop-file-utils' 'hicolor-icon-theme')
deps_redos=('pulseaudio-libs' 'gstreamer1-plugins-base' 'gstreamer1-plugins-ugly' 'libXScrnSaver' 'dejavu-sans-fonts' 'liberation-fonts' 'google-carlito-fonts')
build_deps_redos=('bsdtar')
opt_deps=('libreoffice: for OpenSymbol fonts')
options=('!strip' '!emptydirs')
sources=("https://github.com/ONLYOFFICE/DesktopEditors/releases/download/v${version}/onlyoffice-desktopeditors_amd64.deb")
checksums=('SKIP')
prepare() {
cd $srcdir
mkdir -p "onlyoffice-${version}/pkg"
bsdtar -xf "${srcdir}/onlyoffice-desktopeditors_amd64.deb" -C "onlyoffice-${version}"
bsdtar -xf "onlyoffice-${version}/data.tar.xz" -C "onlyoffice-${version}/pkg"
patch -d ./onlyoffice-${version}/pkg -Np1 -i "${scriptdir}/010-onlyoffice-bin-fix-document-opening.patch"
}
scripts=(
['postinstall']='postinstall.sh'
)
package() {
cd $srcdir
cp -dr --no-preserve='ownership' "onlyoffice-${version}"/pkg/* "$pkgdir"
_file
_res
while read -r -d '' _file
do
_res="$(sed 's/\.png$//;s/^.*-//' <<< "$_file")"
install -d -m755 "${pkgdir}/usr/share/icons/hicolor/${_res}x${_res}/apps"
ln -s "../../../../../../opt/onlyoffice/desktopeditors/asc-de-${_res}.png" \
"${pkgdir}/usr/share/icons/hicolor/${_res}x${_res}/apps/onlyoffice-desktopeditors.png"
done < <(find "${pkgdir}/opt/onlyoffice/desktopeditors" -maxdepth 1 -type f -name 'asc-de-*.png' -print0)
rename_directories() {
for dir in "$1"/*; do
if [ -d "$dir" ]; then
dir_name=$(basename "$dir")
if [[ "$dir_name" == *\{*\}* ]]; then
new_dir_name=$(echo "$dir_name" | tr -d '{}')
mv "$dir" "$1/$new_dir_name"
echo "Переименован: $dir -> $1/$new_dir_name"
rename_directories "$1/$new_dir_name"
else
rename_directories "$dir"
fi
fi
done
}
rename_files() {
DIRECTORY="$pkgdir/opt/onlyoffice/desktopeditors/converter/templates/"
# Перебор всех файлов в директории
# Рекурсивный перебор всех файлов в директории и её поддиректориях
find "$DIRECTORY" -type f | while IFS= read -r FILE; do
BASENAME=$(basename "$FILE")
DIRNAME=$(dirname "$FILE")
# Проверка, начинается ли имя файла с '[32]'
if [[ "$BASENAME" == $32$* ]]; then
# Новое имя файла с удалёнными скобками
NEW_NAME="32${BASENAME:4}"
mv "$FILE" "$DIRNAME/$NEW_NAME"
echo "File renamed: $FILE -> $DIRNAME/$NEW_NAME"
fi
done
}
# Запускаем функцию переименования с корневым каталогом
rename_directories "${pkgdir}/opt/onlyoffice/desktopeditors/editors/sdkjs-plugins"
rename_files
# 3rd party licenses
install -d -m755 "${pkgdir}/usr/share/licenses/${name}"
ln -s $pkgdir/$name/opt/onlyoffice/desktopeditors/3DPARTYLICENSE "${pkgdir}/usr/share/licenses/${name}/3DPARTYLICENSE"
}