File deepin-file-polkit-installer.in of Package deepin-file-manager
#!/bin/bash
# Name: Deepin File profiles installer
# Version: 1.0
# Description: On openSUSE, deepin-file-manager does not install polkit 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-file-manager polkit installer, it helps you to install the polkit \
profiles for Deepin File Manager. These profiles will enable the full features for Deepin Desktop."
echo "These polkit profiles are not appraised 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-polkit installation."
exit 1
fi
SYSTEM_TMP=/tmp
TMP_DIR=$SYSTEM_TMP/deepin-file-polkit
pushd /usr/share/polkit-1/actions/ &>/dev/null
Filelist1=&(ls com.deepin.filemanager*) &>/dev/null
if [ "$Filelist1" != "" ]; then
rm -rf "$Filelist1"
fi
Filelist2=&(ls com.deepin.pkexec*) &>/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/polkit.tar.gz &>/dev/null
cp polkit/* /usr/share/polkit-1/actions/
chmod 0644 /usr/share/polkit-1/actions/com.deepin.filemanager* \
com.deepin.pkexec*
popd &>/dev/null
rm -rf $TMP_DIR
echo "Deepin polkit profiles install succeed!"