From e5948745ee4b3e23a1d4c0685a9fddbd425a19b0 Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Tue, 20 Sep 2011 18:46:36 +0100 Subject: [PATCH] Move root user check to linux shell script --- SparkleShare/Program.cs | 10 ---------- SparkleShare/sparkleshare.in | 5 +++++ 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/SparkleShare/Program.cs b/SparkleShare/Program.cs index cfbd0ce0..4291d3bb 100644 --- a/SparkleShare/Program.cs +++ b/SparkleShare/Program.cs @@ -45,16 +45,6 @@ namespace SparkleShare { public static void Main (string [] args) { - // Don't allow running as root on Linux or Mac - /* if ((SparkleBackend.Platform == PlatformID.Unix || - SparkleBackend.Platform == PlatformID.MacOSX) && - new UnixUserInfo (UnixEnvironment.UserName).UserId == 0) { - - Console.WriteLine (_("Sorry, you can't run SparkleShare with these permissions.")); - Console.WriteLine (_("Things would go utterly wrong.")); - Environment.Exit (-1); - } - */ // Parse the command line options bool show_help = false; OptionSet option_set = new OptionSet () { diff --git a/SparkleShare/sparkleshare.in b/SparkleShare/sparkleshare.in index 88302a5c..019088fe 100644 --- a/SparkleShare/sparkleshare.in +++ b/SparkleShare/sparkleshare.in @@ -1,5 +1,10 @@ #!/bin/bash +if [[ $UID -e 0 ]]; then + echo "Cannot run as root. Things would go utterly wrong." + exit 1 +fi + if [ "$XDG_RUNTIME_DIR" ]; then pidfile=${XDG_RUNTIME_DIR}/sparkleshare.pid else