File deepin-daemon-dbus-installer.in of Package deepin-daemon
#!/bin/bash
# Name: Deepin DBus profiles installer
# Version: 1.1
# Description: On openSUSE, deepin-daemon does not install dbus profiles by default
# for security. 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 daemon profiles installer, it helps you to install the dbus \
profiles for Deepin daemon. These profiles will enable the full features for Deepin Desktop."
echo "These dbus profiles are not appraised by SUSE security Team. Maybe install these \
profiles would bring some unknown security issues. 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-daemon-dbus installation."
exit 1
fi
SYSTEM_TMP=/root/.cache
TMP_DIR=$SYSTEM_TMP/deepin-daemon-dbus
pushd /usr/share/dbus-1/system.d/ &>/dev/null
Filelist1=&(ls com.deepin.daemon*) &>/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.daemon*) &>/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-daemon/dbus.tar.gz &>/dev/null
cp dbus/system.d/* /usr/share/dbus-1/system.d/
cp dbus/system-services/* /usr/share/dbus-1/system-services/
chmod 0644 /usr/share/dbus-1/system.d/com.deepin.daemon*
chmod 0644 /usr/share/dbus-1/system-services/com.deepin.daemon*
popd &>/dev/null
rm -rf $TMP_DIR
echo "Deepin DBus profiles install succeed!"