Переписаны xdm скрипты для fastlogin

Добавлен 05fastlogin
develop
Mike Khiretskiy 9 years ago
parent 3fb6384f52
commit aca30643c0

@ -26,3 +26,13 @@ desktop_variable_value()
local varname=$1
/usr/sbin/cl-core-variables-show --only-value $varname
}
# get user domain set
get_ur_domain_set() {
if rc-update show default | grep client &>/dev/null
then
desktop_variable_value desktop.ur_domain_set
else
echo "off"
fi
}

@ -1,5 +1,5 @@
#! /bin/sh
# Copyright 2010 Calculate Ltd. http://www.calculate-linux.org
# Copyright 2010-2015 Calculate Ltd. http://www.calculate-linux.org
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -13,31 +13,33 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# set background color
if [[ -f /usr/share/wallpapers/dm-background.png ]]
then
feh --no-fehbg --bg-scale /usr/share/wallpapers/dm-background.png
else
if ls /var/db/pkg/media-gfx/cld[-gx]*themes-12* &>/dev/null
then
xsetroot -solid rgb:73/a3/63
else
xsetroot -solid rgb:30/64/8b
fi
fi
run_script() {
# set background color
if [[ -f /usr/share/wallpapers/dm-background.png ]]
then
feh --no-fehbg --bg-scale /usr/share/wallpapers/dm-background.png
else
if ls /var/db/pkg/media-gfx/cld[-gx]*themes-12* &>/dev/null
then
xsetroot -solid rgb:73/a3/63
else
xsetroot -solid rgb:30/64/8b
fi
fi
/sbin/modprobe ecryptfs
/sbin/modprobe ecryptfs
if [[ "`ps axeo command | grep 'xdm/xdm --logout' | grep -v grep | \
sed -n -r 's/.* USER=([^ ]+) .*/\1/p'`" == "$USER" ]];
then
xmessage -buttons "" "Please wait to ending previous session" &
XMESPID=$!
while [[ "`ps axeo command | grep 'xdm/xdm --logout' | grep -v grep | \
sed -n -r 's/.* USER=([^ ]+) .*/\1/p'`" == "$USER" ]]
do
sleep 1
done
kill -9 $XMESPID &>/dev/null
fi
exit 0
if [[ "`ps axeo command | grep 'xdm/xdm --logout' | grep -v grep | \
sed -n -r 's/.* USER=([^ ]+) .*/\1/p'`" == "$USER" ]];
then
xmessage -buttons "" "Please wait to ending previous session" &
XMESPID=$!
while [[ "`ps axeo command | grep 'xdm/xdm --logout' | grep -v grep | \
sed -n -r 's/.* USER=([^ ]+) .*/\1/p'`" == "$USER" ]]
do
sleep 1
done
kill -9 $XMESPID &>/dev/null
fi
return 0
}

@ -0,0 +1,29 @@
#! /bin/sh
# Copyright 2015 Calculate Ltd. http://www.calculate-linux.org
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
run_script() {
# skip cl-desktop and other scripts: user profile is configured already
if [[ "${DOMAIN_USER}" == "off" ]] &&
[[ -d ${HOME_DIR} ]] &&
[[ -f /var/lib/calculate/calculate-desktop/fastlogin/${USER} ]]
then
# break as success xdm --login
return 2
else
/usr/sbin/env-update
source /etc/profile
return 0
fi
}

@ -1,5 +1,5 @@
#! /bin/sh
# Copyright 2010-2012 Calculate Ltd. http://www.calculate-linux.org
# Copyright 2010-2015 Calculate Ltd. http://www.calculate-linux.org
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -13,23 +13,18 @@
# See the License for the specific language governing permissions and
# limitations under the License.
/usr/sbin/env-update
source /etc/profile
source /usr/share/calculate/xdm/functions
if [ -e '/usr/sbin/cl-desktop' ];
then
# skip desktop configure if user not domain and it already has home dir
# with not /etc/skel contents
userHome=`getent passwd $USER | awk -F: '{ print( $6 ); }'`
ERRORLOG=`/usr/sbin/cl-desktop --gui-progress $USER 2>&1`
# raise xmessage error if cl-desktop failed
if [ "$?" -gt "0" ];
then
# write error message to logfile
echo "$ERRORLOG" >> $FILE_LOG
# display error by xmessage
exit 1
fi
fi
exit 0
run_script() {
if [ -e '/usr/sbin/cl-desktop' ];
then
ERRORLOG=`/usr/sbin/cl-desktop --gui-progress $USER 2>&1`
# raise xmessage error if cl-desktop failed
if [ "$?" -gt "0" ];
then
# write error message to logfile
echo "$ERRORLOG" >> $FILE_LOG
# display error by xmessage
return 1
fi
fi
return 0
}

@ -1,5 +1,5 @@
#! /bin/sh
# Copyright 2008-2012 Calculate Ltd. http://www.calculate-linux.org
# Copyright 2008-2015 Calculate Ltd. http://www.calculate-linux.org
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -13,7 +13,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# clear kde cache
/bin/rm -rf /var/tmp/kdecache-$USER
exit 0
run_script() {
# clear kde cache
/bin/rm -rf /var/tmp/kdecache-$USER
return 0
}

@ -1,5 +1,5 @@
#! /bin/sh
# Copyright 2010 Calculate Ltd. http://www.calculate-linux.org
# Copyright 2010-2015 Calculate Ltd. http://www.calculate-linux.org
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -13,16 +13,18 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# set background color
if [[ -f /usr/share/wallpapers/dm-background.png ]]
then
feh --no-fehbg --bg-scale /usr/share/wallpapers/dm-background.png
else
if ls /var/db/pkg/media-gfx/cld[-gx]*themes-12* &>/dev/null
then
xsetroot -solid rgb:73/a3/63
else
xsetroot -solid rgb:30/64/8b
fi
fi
exit 0
run_script() {
# set background color
if [[ -f /usr/share/wallpapers/dm-background.png ]]
then
feh --no-fehbg --bg-scale /usr/share/wallpapers/dm-background.png
else
if ls /var/db/pkg/media-gfx/cld[-gx]*themes-12* &>/dev/null
then
xsetroot -solid rgb:73/a3/63
else
xsetroot -solid rgb:30/64/8b
fi
fi
return 0
}

@ -1,20 +1,33 @@
#!/bin/bash
#
# Syncronize icon face from local user to kdm
# (c) 2013 Calculate Ltd. http://www.calculate-linux.org
# Copyright 2013-2015 Calculate Ltd. http://www.calculate-linux.org
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# get icon face directory from kdm config
get_icon_face_dir() {
local config_file=/usr/share/config/kdm/kdmrc
[[ -f $config_file ]] && sed -rn 's/^FaceDir=(.*)/\1/p' $config_file
local config_file=/usr/share/config/kdm/kdmrc
[[ -f $config_file ]] && sed -rn 's/^FaceDir=(.*)/\1/p' $config_file
}
# copy .face.icon from user home directory to kdm face directory
if [[ $DOMAIN_USER == "off" ]] && [[ -f $HOME_DIR/.face.icon ]]; then
FACE_DIR=$(get_icon_face_dir)
if [[ -n $FACE_DIR ]] && [[ -d $FACE_DIR ]];then
cp $HOME_DIR/.face.icon $FACE_DIR/${USER}.face
fi
fi
exit 0
run_script() {
# copy .face.icon from user home directory to kdm face directory
if [[ $DOMAIN_USER == "off" ]] && [[ -f $HOME_DIR/.face.icon ]]; then
FACE_DIR=$(get_icon_face_dir)
if [[ -n $FACE_DIR ]] && [[ -d $FACE_DIR ]];then
cp $HOME_DIR/.face.icon $FACE_DIR/${USER}.face
fi
fi
return 0
}

@ -1,5 +1,20 @@
#!/bin/bash
# Copyright 2013-2015 Calculate Ltd. http://www.calculate-linux.org
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
keyctl unlink $( keyctl request user $USER )
umount -l /home/$USER
exit 0
run_script() {
keyctl unlink $( keyctl request user $USER )
umount -l /home/$USER
return 0
}

@ -139,18 +139,24 @@ if [[ $EXECDIR == /usr/share/calculate/xdm ]]; then
die "must specify option"
fi
[[ -e ${EXECDIR} ]] || die "${EXECDIR} is not exists"
FILELIST=$(find ${EXECDIR} -type f | sort)
[[ $FILELIST ]] || warning "${EXECDIR} hasn't scripts"
gtk_background
DOMAIN_USER="`desktop_variable_value desktop.ur_domain_set`"
DOMAIN_USER="`get_ur_domain_set`"
HOME_DIR=`getent passwd $USER | awk -F: '{ print( $6 ); }'`
for script in $FILELIST
do
FILE_LOG=$FILE_LOG HOME_DIR=$HOME_DIR USER=$USER DOMAIN_USER=$DOMAIN_USER /bin/bash $script || die_xmes "failed on execute $script"
source $script && run_script
res=$?
case $res in
0) continue ;;
1) die_xmes "failed on execute $script" ;;
2) break ;;
esac
done
sleep_kill()

@ -73,6 +73,7 @@ data_files = [('/usr/share/calculate/xdm', [('data/cmd_login', 0755),
('data/setbg', 0755)]),
('/usr/share/calculate/xdm/login.d',
['data/login.d/00init',
'data/login.d/05fast_login',
'data/login.d/20desktop',
'data/login.d/99final']),
('/usr/share/calculate/xdm/logout.d',

Loading…
Cancel
Save