Skip to content

Commit

Permalink
hotfix(oomoxify): revise polkit detection
Browse files Browse the repository at this point in the history
  • Loading branch information
actionless committed Jul 18, 2017
1 parent 7affea9 commit 51f1288
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 7 deletions.
8 changes: 4 additions & 4 deletions PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
# Upstream URL: https://github.com/actionless/oomox

pkgname=oomox-git
pkgver=1.2.7
pkgrel=2
pkgver=1.2.7.1
pkgrel=1
pkgdesc="Graphical application for generating different color variations
of Numix theme (GTK2, GTK3), gnome-colors and ArchDroid icon themes.
Have a hack for HiDPI in gtk2."
Expand All @@ -15,6 +15,7 @@ source=(
)
md5sums=("SKIP")
depends=(
'coreutils'
'bash'
'bc'
'zip'
Expand All @@ -24,7 +25,6 @@ depends=(
'python-gobject'
'gtk-engine-murrine'
'gtk-engines'
'procps-ng'
'polkit'
)
optdepends=(
Expand All @@ -46,7 +46,7 @@ package() {
make -C oomox -f po.mk install
mkdir -p ${pkgdir}/opt/oomox
mv ./oomox/* ${pkgdir}/opt/oomox
python -O -m compileall ${pkgdir}/opt/oomox/oomox_gui
python -O -m compileall ${pkgdir}/opt/oomox/oomox_gui
mkdir -p ${pkgdir}/usr/bin/
mkdir -p ${pkgdir}/usr/share/applications/

Expand Down
30 changes: 27 additions & 3 deletions oomoxify.sh
Original file line number Diff line number Diff line change
Expand Up @@ -266,13 +266,37 @@ for file in $(ls "${backup_dir}"/*.spa) ; do
rm "${tmp_dir}/"* -r
done

PKEXEC="pkexec --disable-internal-agent"
if [ ! -z "${gui:-}" ] ; then
if [ "$(pgrep polkit)" ] ; then
priv_tool="pkexec"
if [ "$(which pkexec)" ] ; then
priv_tool=${PKEXEC}
else
priv_tool="gksu"
fi
else
priv_tool="sudo"
fi
"${priv_tool}" cp "${output_dir}/"* "${spotify_apps_path}"/

log_file=$(mktemp)
function post_clean_up {
rm "${log_file}"
}
trap post_clean_up EXIT SIGHUP SIGINT SIGTERM
fails_counter=0
while true; do
exit_code=0
${priv_tool} cp "${output_dir}/"* "${spotify_apps_path}"/ 2>&1 | tee ${log_file} || exit_code=$?
if [ $exit_code -ne 0 ] ; then
if [ "${priv_tool}" = "${PKEXEC}" ] && [ "$(grep "No authentication agent found." ${log_file})" ] ; then
priv_tool="gksu"
else
fails_counter=$((fails_counter + 1))
fi
if [ ${fails_counter} -gt 3 ] ; then
break
fi
else
break
fi
done
exit ${exit_code}

0 comments on commit 51f1288

Please sign in to comment.