Changeset e8de1daf for core


Ignore:
Timestamp:
Nov 6, 2016 12:49:34 AM (4 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
26a24a9
Parents:
11e8611
Message:

Util: Consolidate linux service detection code

File:
1 edited

Legend:

Unmodified
Added
Removed
  • core/java/src/net/i2p/util/SystemVersion.java

    r11e8611 re8de1daf  
    1616 */
    1717public abstract class SystemVersion {
     18
     19    /*
     20     *  @since 0.9.28
     21     */
     22    public static final String DAEMON_USER = "i2psvc";
    1823
    1924    private static final boolean _isWin = System.getProperty("os.name").startsWith("Win");
     
    3035    private static final boolean _is64;
    3136    private static final boolean _hasWrapper = System.getProperty("wrapper.version") != null;
     37    private static final boolean _isLinuxService = !_isWin && !_isMac &&
     38                                                   DAEMON_USER.equals(System.getProperty("user.name"));
    3239
    3340    private static final boolean _oneDotSix;
     
    194201    }
    195202
     203    /*
     204     *  @since 0.9.28
     205     */
     206    public static boolean isLinuxService() {
     207        return _isLinuxService;
     208    }
     209
    196210    /**
    197211     *  Identical to android.os.Build.VERSION.SDK_INT.
     
    269283        System.out.println("Gentoo   : " + isGentoo());
    270284        System.out.println("GNU      : " + isGNU());
     285        System.out.println("Linux Svc: " + isLinuxService());
    271286        System.out.println("OpenJDK  : " + isOpenJDK());
    272287        System.out.println("Windows  : " + isWindows());
Note: See TracChangeset for help on using the changeset viewer.