9 images
=/lib
/splash
/arch-banner
/images
11 # Directory from which the splash daemon loads
12 # variable theme files (services icons) at startup
13 # which need to be available after mounting the
14 # splash cache even without theme hook script support
15 work_dir
=/etc
/splash
/$SPLASH_THEME/cache
16 # Directory where temporary hook data files are stored
17 # which need to be moved in by the initcpio hook
18 work_dir_hooks
=$spl_cachedir/hook-data-
$SPLASH_THEME
21 while mountpoint
-q "${work_dir}"; do
22 umount
"$@" -l "${work_dir}"
28 in install | uninstall
) # run by pacman package install script
29 work_dir
=${work_dir#/}
30 ( cd "${work_dir%/*}" ) # verify theme dir is there
33 [[ $1 = uninstall
]] && exit
34 ;; sysinit | shutdown | reboot |
suspend )
35 ;; * ) # "rc_init boot"
38 if [[ $1 = install ]]; then
40 elif [[ $0 = */rc_init-post
]]; then
41 # This does nothing, if the splash daemon was started in the initcpio.
45 mount
-n -s -t tmpfs cachedir
"${work_dir}" -o rw
,mode
=0755,noexec
,nosuid
,nodev
,size
=4096k
49 # Link invisible dummy icons
51 for state
in start stop fail
; do
52 ln -sfT $images/dummy.png
"${work_dir}"/${state}
53 ln -sfT $images/dummy.png
"${work_dir}"/cover-
${state}
56 for (( num
=1; num
<=icon_count
; num
++ )) do
57 ln -sfT $images/dummy.png
"${work_dir}"/svc_
${num}_start
58 ln -sfT $images/dummy.png
"${work_dir}"/svc_
${num}_stop
61 [[ $1 = install ]] && exit 0
63 ICON_THEME
=/usr
/share
/icons
/Tango
64 .
/etc
/splash
/$SPLASH_THEME/icons.conf
65 [[ $ICON_THEME = /* ]] || ICON_THEME
=/usr
/share
/icons
/$ICON_THEME
67 # args: <icon-rel-path> <symlink-name>
69 if [[ -f $ICON_THEME/$ICON_SIZE/${1} ]]; then
70 ln -sfT "$ICON_THEME/$ICON_SIZE/${1}" "${work_dir}/${2}"
72 echo "${0}: File not found: '$ICON_THEME/$ICON_SIZE/${1}'" >&2
77 # Link status emblem icons if available or enable semi transparent covers
79 ICON_SIZE
=${icon_size_small}x
${icon_size_small}
80 if ! [[ $ICON_start ]] ||
! ln_svcicon
"${ICON_start}" start
; then
81 ln -sfT $images/cover-a50.png
"${work_dir}"/cover-start
82 ln -sfT $images/cover-a50.png
"${work_dir}"/cover-fail
84 if ! [[ $ICON_stop ]] ||
! ln_svcicon
"${ICON_stop}" stop
; then
85 ln -sfT $images/cover-a50.png
"${work_dir}"/cover-stop
86 ln -sfT $images/cover-a50.png
"${work_dir}"/cover-fail
88 if ! [[ $ICON_fail ]] ||
! ln_svcicon
"$ICON_fail" fail
; then
89 ln -sfT $images/cover-a50.png
"${work_dir}"/cover-fail
92 # Link service icons and save positions for fast lookup
94 ICON_SIZE
=${icon_size}x
${icon_size}
96 declare -A SERVICE_ICONS_AA
=()
97 for (( i
=0; i
<${#SERVICE_ICONS[@]}; i
+=2 )) do
98 svc
=${SERVICE_ICONS[i]}
99 icon
=${SERVICE_ICONS[i+1]}
100 SERVICE_ICONS_AA
[$svc]+=" ${icon}"
103 # Get first existing icon for service from configuration
106 local icon icons
=${SERVICE_ICONS_AA[$1]}
107 for icon
in $icons; do
108 [[ -f $ICON_THEME/$ICON_SIZE/$icon ]] ||
continue
112 for icon
in $icons; do
113 echo "${0}: File not found: '$ICON_THEME/$ICON_SIZE/${icon}'" >&2
118 # splash_manager runs us without a tmpfs mounted
119 mkdir
-p "${work_dir_hooks}"
120 rm -f "${work_dir_hooks}"/svcicon_num_
*
122 # args: <service-name> start|stop
125 icon
=$
( svcicon_get
"${svc}" ) ||
return 0
126 ln_svcicon
"${icon}" svc_$
(( ++ICON_NUM
))_
$2
127 echo $ICON_NUM >|
"${work_dir_hooks}"/svcicon_num_
"${svc}"_
$2
129 # Note: If no UDev in initcpio, process substitution doesn't work
130 splash_svclist_get stop
> "${work_dir}"/svcs_stop
131 readarray
-t svclist
< "${work_dir}"/svcs_stop
133 for (( i
=${#svclist[@]}-1; i
>=0; i--
)) do
134 svc_icon_num
"${svclist[i]}" stop
136 splash_svclist_get start
> "${work_dir}"/svcs_start
137 readarray
-t svclist
< "${work_dir}"/svcs_start
139 for svc
in "${svclist[@]}"; do
140 svc_icon_num
"${svc}" start