postinst is in freevo 1.9.2b2-4.2.
This file is a maintainer script. It is executed when installing (*inst) or removing (*rm) the package.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 | #!/bin/sh -e
DAEMON=/usr/bin/freevo
action="$1"
#These variables affect how freevo works, if you want to really set
# those, put them in /etc/default/freevo . See also /etc/freevo/debconf.sh
unset OS_LOGDIR FREEVO_LOGDIR OS_STATICDIR FREEVO_STATICDIR OS_CACHEDIR FREEVO_CACHEDIR FREEVO_SHARE FREEVO_CONTRIB FREEVO_SCRIPT FREEVO_CONFIG DISPLAY LD_PRELOAD SDL_VIDEODRIVER FREEVO_LOCALE FREEVO_PYTHON
. /etc/default/freevo
. /usr/share/debconf/confmodule
db_version 2.0
write_freevo_conf() {
db_get freevo/display
display="$RET"
db_get freevo/geometry
geometry="$RET"
db_get freevo/norm
norm="$RET"
db_get freevo/chanlist
chanlist="$RET"
$DAEMON.real setup --geometry="$geometry" \
--display="$display" \
--tv="$norm" \
--chanlist="$chanlist" \
--sysfirst > /dev/null
}
create_dir() {
if test ! -e "$1" ; then
echo "Creating $2 directory $1 for freevo" 1>&2
mkdir --parents "$1"
#these two may fail if the dir is in a VFAT mount
chown freevo:freevo "$1" || true
chmod 775 "$1" || true
else
if test ! -d "$1" ; then
echo "WARNING: freevo $2 directory should be $1 , " 1>&2
echo " but this latter exists and is not a directory - freevo will malfunction" 1>&2
else
: #TODO may check permissions and ownership
: # maybe using find "$1" -maxdepth 0 -printf '%u' | grep -qx freevo
fi
fi
su --shell /bin/sh freevo -c "touch \"$1\"/.placeholder" || {
echo "WARNING: 'freevo' user cannot create files in $2 directory $1 , " 1>&2
echo " freevo will malfunction " 1>&2 ; }
}
write_local_conf() {
create_dir $FREEVO_CACHEDIR cache
create_dir $FREEVO_LOGDIR log
create_dir $FREEVO_STATICDIR static
db_get freevo/title_video
title_video="$RET"
db_get freevo/path_to_video
path_to_video="$RET"
create_dir "$RET" video
db_get freevo/title_audio
title_audio="$RET"
db_get freevo/path_to_audio
path_to_audio="$RET"
create_dir "$RET" audio
db_get freevo/title_image
title_image="$RET"
db_get freevo/path_to_image
path_to_image="$RET"
create_dir "$RET" image
db_get freevo/path_to_recordings
path_to_recordings="$RET"
create_dir "$RET" recordings
uid=`id -u freevo`
gid=`id -g freevo`
uidgid () { echo "${1}_UID=$uid" ; echo "${1}_GID=$gid" ; }
(
exec > /etc/freevo/debconf.py
echo '# -*- coding: utf-8 -*-'
echo '#This file is automatically generated by the freevo Debian package'
echo '#To change these values, run "dpkg-reconfigure freevo"'
echo '#To override or add to these values, edit /etc/freevo/local_conf.py'
echo "VIDEO_ITEMS = [ ('$title_video', '$path_to_video') ]"
echo "AUDIO_ITEMS = [ ('$title_audio', '$path_to_audio') ]"
echo "IMAGE_ITEMS = [ ('$title_image', '$path_to_image') ]"
echo "TV_RECORD_DIR = '$path_to_recordings'"
uidgid COMMDETECTSERVER
uidgid ENCODINGSERVER
uidgid RECORDSERVER
uidgid RSSSERVER
uidgid WEBSERVER
echo "#note that FREEVO_UID and FREEVO_GID exist only in Debian code"
uidgid FREEVO
)
db_get freevo/services
services=",$RET ,"
(
exec > /etc/freevo/debconf.sh
echo '#This file is automatically generated by the freevo Debian package'
echo '#To change these values, run "dpkg-reconfigure freevo"'
echo '#To override or add to these values, edit /etc/default/freevo'
uidgid FREEVO
for s in xserver recordserver encodingserver webserver rssserver ; do
S=`echo $s | tr 'a-z' 'A-Z'`
case "$services" in
*$s*) echo "START_FREEVO_${S}=1" ;;
*) echo "START_FREEVO_${S}=0" ;;
esac
done
)
LOCAL_CONF=/etc/freevo/local_conf.py
[ -r $LOCAL_CONF ] || cp $LOCAL_CONF.example $LOCAL_CONF
}
freevo_cache() {
su --shell /bin/sh freevo -c '$DAEMON.real cache'
find $FREEVO_CACHEDIR -type f -print0 | xargs -0 chmod 0664
find $FREEVO_CACHEDIR -type d -print0 | xargs -0 chmod 0775
}
update_record_schedule () {
a=${FREEVO_STATICDIR}/record_schedule.xml
if test -r $a ; then
t=`tempfile`
echo "Freevo: upgrading $a. (Log in $t)" 1>&2
( exec > $t 2> $t
mv $a $a~oldformat
invoke-rc.d freevo_recordserver stop
su --shell /bin/sh freevo -c "freevo convert_favorites $a~oldformat"
invoke-rc.d freevo_recordserver start
su --shell /bin/sh freevo -c "freevo schedulefavorites"
)
fi
}
case "$1" in
configure)
# creating group
if ! getent group freevo >/dev/null; then
addgroup --system freevo
fi
# creating user
if ! getent passwd freevo > /dev/null ; then
echo "Adding user 'freevo'." 1>&2
adduser --ingroup freevo --quiet --home /var/lib/freevo \
--disabled-login --system freevo
fi
for a in cdrom audio plugdev ; do
adduser --quiet freevo $a
done
write_freevo_conf
write_local_conf
update_record_schedule
;;
abort-upgrade) ;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
# Automatically added by dh_installinit
if [ -x "/etc/init.d/freevo_xserver" ]; then
if [ ! -e "/etc/init/freevo_xserver.conf" ]; then
update-rc.d freevo_xserver defaults >/dev/null
fi
fi
# End automatically added section
# Automatically added by dh_installinit
if [ -x "/etc/init.d/freevo_recordserver" ]; then
if [ ! -e "/etc/init/freevo_recordserver.conf" ]; then
update-rc.d freevo_recordserver defaults >/dev/null
fi
fi
# End automatically added section
# Automatically added by dh_installinit
if [ -x "/etc/init.d/freevo_encodingserver" ]; then
if [ ! -e "/etc/init/freevo_encodingserver.conf" ]; then
update-rc.d freevo_encodingserver defaults >/dev/null
fi
fi
# End automatically added section
# Automatically added by dh_installinit
if [ -x "/etc/init.d/freevo_webserver" ]; then
if [ ! -e "/etc/init/freevo_webserver.conf" ]; then
update-rc.d freevo_webserver defaults >/dev/null
fi
fi
# End automatically added section
# Automatically added by dh_installinit
if [ -x "/etc/init.d/freevo_rssserver" ]; then
if [ ! -e "/etc/init/freevo_rssserver.conf" ]; then
update-rc.d freevo_rssserver defaults >/dev/null
fi
fi
# End automatically added section
# Automatically added by dh_python2:
if which pycompile >/dev/null 2>&1; then
pycompile -p freevo /usr/share/freevo -V 2.6-
fi
# End automatically added section
|