File deepin-file-dbus-installer.in of Package deepin-file-manager
#!/bin/bash
# Name: Deepin File Manager DBus profiles installer
# Version: 1.0
# Description: On openSUSE, deepin-file-manager does not install dbus profiles
# by default for security (boo#1134132 and boo#1134131). The tool can help users
# to install these profiles for getting the full features of Deepin Desktop, if
# user does not care security.
# Author: Hillwood Yang <hillwood@opensuse.org>
# License: WTFPL-2.0
if [ "$(id -u)" != "0" ]; then
echo "error: You must be root to use this program!"
exit 1
fi
while :
do
ANSWER=n
echo "This is the deepin-file-manager dbus profiles installer, it helps you to install the dbus \
profiles for Deepin File Manager. These profiles will enable the full features for Deepin Desktop."
echo "But these dbus profiles are not accepted by SUSE security Team. Install these profiles\
will bring some security issues (boo#1134132 and boo#1134131). Are you sure that you install\
this files anyhow?[Yes/No]N"
read ANSWER
case $ANSWER in
Y | y | yes | Yes)
break;;
N | n | no | No)
break;;
*)
echo "Unknown response, please reinput";;
esac
done
if [ "$ANSWER" = "n" ] || [ "$ANSWER" = "N" ] || [ "$ANSWER" = "no" ] || [ "$ANSWER" = "No" ]; then
echo "Exit deepin-file-dbus installation."
exit 1
fi
SYSTEM_TMP=/tmp
TMP_DIR=$SYSTEM_TMP/deepin-file-dbus
pushd /etc/dbus-1/system.d/ &>/dev/null
Filelist1=&(ls com.deepin.filemanager*) &>/dev/null
if [ "$Filelist1" != "" ]; then
rm -rf "$Filelist1"
fi
popd &>/dev/null
pushd /usr/share/dbus-1/system-services/ &>/dev/null
Filelist2=&(ls com.deepin.filemanager*) &>/dev/null
if [ "$Filelist2" != "" ]; then
rm -rf "$Filelist2"
fi
popd &>/dev/null
mkdir -p $TMP_DIR
pushd $TMP_DIR &>/dev/null
tar -xvf /usr/share/dde-file-manager/dbus.tar.gz &>/dev/null
cp dbus/system.d/* /etc/dbus-1/system.d/
cp dbus/system-services/* /usr/share/dbus-1/system-services/
chmod 0644 /etc/dbus-1/system.d/com.deepin.filemanager*
chmod 0644 /usr/share/dbus-1/system-services/com.deepin.filemanager*
popd &>/dev/null
rm -rf $TMP_DIR
echo "Deepin DBus profiles install succeed!"