source: src-sh/de-info/de-info @ 1620346

9.1-release9.2-releasereleng/10.0releng/10.0.1releng/10.0.2releng/10.0.3
Last change on this file since 1620346 was 1620346, checked in by Kris Moore <kris@…>, 18 months ago

Initial import of PC-BSD /current/ SVN repo

  • Property mode set to 100755
File size: 3.0 KB
Line 
1#!/bin/sh
2
3PROFILES_PREFIX="/usr/local/share/pcbsd/de-profiles"
4
5SHOW_INSTALLED=0
6SHOW_ALL=0
7SHOW_ONLY_ACTIVE=1
8SHOW_TERMINAL=0
9SHOW_FILEMAN=0
10
11DEFAULT_TERMINAL="xterm"
12DEFAULT_SUDO="pc-su %s"
13DEFAULT_TERMINAL_COMMAND="-e"
14DEFAULT_TERMINAL_TITLE="-T"
15DEFAULT_TERMINAL_SEPARATE_ARGS="NO"
16display_help()
17{
18  echo "de-info - display desktop environment info script"
19  echo "usage: de-info [-i] [-a] [-terminal] [-fileman]"
20  echo " Without any params script displays current active desktop environment info"
21  echo " -i - display installed desktop environments list"
22  echo " -a - display all supported desktop environments list"
23  echo " -terminal - display terminal application call related to current environment"
24  echo " -fileman - display file manager related to current desktop environment"
25  exit 0
26}
27
28display_de_info()
29{
30    echo
31    echo "DE name: $DE_NAME"
32    if [ $DE_ACTIVE -eq 1 ] ; then
33      echo "Current DE: YES"
34      DE_INSTALLED=1
35    else
36      echo "Current DE: NO"
37    fi
38    if [ $DE_INSTALLED -eq 1 ] ; then
39      echo "Installed: YES"
40    else
41      echo "Installed: NO"
42    fi
43    if [ "$XDG" = "1" ] ; then
44      XDG="YES"
45    fi
46      echo "XDG compatible: $XDG"
47      echo "Sudo command: $DE_SU" 
48      echo "File manager: $DE_FILEMAN"
49      echo "Terminal: $DE_TERMINAL"
50      echo "Terminal title switch: $DE_TERMINAL_TITLE"
51      echo "Terminal command switch: $DE_TERMINAL_COMMAND"
52      echo "Terminal command separate args: $DE_TERMINAL_SEPARATE_ARGS"
53}
54
55parse_all()
56{
57  for PROF in `ls $PROFILES_PREFIX/*.profile`
58  do
59  DE_NAME=""
60  XDG=""
61  DE_SU=$DEFAULT_SUDO
62  DE_FILEMAN=""
63  DE_TERMINAL=$DEFAULT_TERMINAL
64  DE_TERMINAL_TITLE=$DEFAULT_TERMINAL_TITLE
65  DE_TERMINAL_COMMAND=$DEFAULT_TERMINAL_COMMAND
66  DE_TERMINAL_SEPARATE_ARGS=$DEFAULT_TERMINAL_SEPARATE_ARGS
67  DE_INSTALLED=0
68  DE_ACTIVE=0
69
70  . $PROF
71
72  active
73  installed
74
75  if  [ $DE_ACTIVE -eq 1 ] ||  ( [ $DE_INSTALLED -eq 1 ] && [ $SHOW_INSTALLED -eq 1 ] ) || [ $SHOW_ALL -eq 1 ]
76  then
77    display_de_info
78  fi
79
80  done
81
82}
83
84parse_current()
85{
86
87for PROF in `ls $PROFILES_PREFIX/*.profile`
88  do
89  DE_NAME=""
90  XDG=""
91  DE_TERMINAL=$DEFAULT_TERMINAL
92  DE_FILEMAN=""
93  DE_TERMINAL=$DEFAULT_TERMINAL
94  DE_TERMINAL_TITLE=$DEFAULT_TERMINAL_TITLE
95  DE_TERMINAL_COMMAND=$DEFAULT_TERMINAL_COMMAND
96  DE_TERMINAL_SEPARATE_ARGS=$DEFAULT_TERMINAL_SEPARATE_ARGS
97
98  DE_INSTALLED=0
99  DE_ACTIVE=0
100
101  . $PROF
102
103  active
104
105  if [ $DE_ACTIVE -eq 1 ] ; then
106    if [ $SHOW_TERMINAL -eq 1 ] ; then
107      echo "$DE_TERMINAL $DE_TERMINAL_COMMAND %s"
108    else
109      if [ $SHOW_FILEMAN -eq 1 ] ; then
110        echo $DE_FILEMAN
111      else
112        display_de_info
113      fi
114    fi
115  fi
116
117  done
118
119}
120
121
122if [ "$1" = "-help" ] || [ "$1" = "--help" ] || [ "$1" = "-?" ] 
123then
124display_help
125fi
126
127if [ "$1" = "-i" ] ; then
128SHOW_INSTALLED=1
129SHOW_ONLY_ACTIVE=0
130fi
131
132if [ "$1" = "-a" ] ; then
133SHOW_ALL=1
134SHOW_ONLY_ACTIVE=0
135fi
136
137if [ "$1" = "-terminal" ] ; then
138SHOW_TERMINAL=1
139fi
140
141if [ "$1" = "-fileman" ] ; then
142SHOW_FILEMAN=1
143fi
144
145
146if [ $SHOW_ONLY_ACTIVE -eq 1 ] ; then
147parse_current
148else
149parse_all
150fi
151
152
Note: See TracBrowser for help on using the repository browser.