-
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't check for updates in demo mode (#163)
- Loading branch information
1 parent
6e9dd0c
commit c5fd1da
Showing
3 changed files
with
28 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* | ||
* Copyright 2024 elementary, Inc. (https://elementary.io) | ||
* SPDX-License-Identifier: GPL-3.0-or-later | ||
*/ | ||
|
||
namespace SettingsDaemon.Utils { | ||
public static bool is_running_in_demo_mode () { | ||
var proc_cmdline = File.new_for_path ("/proc/cmdline"); | ||
try { | ||
var @is = proc_cmdline.read (); | ||
var dis = new DataInputStream (@is); | ||
|
||
var line = dis.read_line (); | ||
if ("boot=casper" in line || "boot=live" in line || "rd.live.image" in line) { | ||
return true; | ||
} | ||
} catch (Error e) { | ||
critical ("Couldn't detect if running in Demo Mode: %s", e.message); | ||
} | ||
|
||
return false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters