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

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

@ -26,3 +26,13 @@ desktop_variable_value()
local varname=$1 local varname=$1
/usr/sbin/cl-core-variables-show --only-value $varname /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 #! /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"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with 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 # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
# set background color run_script() {
if [[ -f /usr/share/wallpapers/dm-background.png ]] # set background color
then if [[ -f /usr/share/wallpapers/dm-background.png ]]
feh --no-fehbg --bg-scale /usr/share/wallpapers/dm-background.png then
else feh --no-fehbg --bg-scale /usr/share/wallpapers/dm-background.png
if ls /var/db/pkg/media-gfx/cld[-gx]*themes-12* &>/dev/null else
then if ls /var/db/pkg/media-gfx/cld[-gx]*themes-12* &>/dev/null
xsetroot -solid rgb:73/a3/63 then
else xsetroot -solid rgb:73/a3/63
xsetroot -solid rgb:30/64/8b else
fi xsetroot -solid rgb:30/64/8b
fi fi
fi
/sbin/modprobe ecryptfs /sbin/modprobe ecryptfs
if [[ "`ps axeo command | grep 'xdm/xdm --logout' | grep -v grep | \ if [[ "`ps axeo command | grep 'xdm/xdm --logout' | grep -v grep | \
sed -n -r 's/.* USER=([^ ]+) .*/\1/p'`" == "$USER" ]]; sed -n -r 's/.* USER=([^ ]+) .*/\1/p'`" == "$USER" ]];
then then
xmessage -buttons "" "Please wait to ending previous session" & xmessage -buttons "" "Please wait to ending previous session" &
XMESPID=$! XMESPID=$!
while [[ "`ps axeo command | grep 'xdm/xdm --logout' | grep -v grep | \ while [[ "`ps axeo command | grep 'xdm/xdm --logout' | grep -v grep | \
sed -n -r 's/.* USER=([^ ]+) .*/\1/p'`" == "$USER" ]] sed -n -r 's/.* USER=([^ ]+) .*/\1/p'`" == "$USER" ]]
do do
sleep 1 sleep 1
done done
kill -9 $XMESPID &>/dev/null kill -9 $XMESPID &>/dev/null
fi fi
exit 0 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 #! /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"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with 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 # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
/usr/sbin/env-update run_script() {
source /etc/profile if [ -e '/usr/sbin/cl-desktop' ];
source /usr/share/calculate/xdm/functions then
ERRORLOG=`/usr/sbin/cl-desktop --gui-progress $USER 2>&1`
if [ -e '/usr/sbin/cl-desktop' ]; # raise xmessage error if cl-desktop failed
then if [ "$?" -gt "0" ];
# skip desktop configure if user not domain and it already has home dir then
# with not /etc/skel contents # write error message to logfile
userHome=`getent passwd $USER | awk -F: '{ print( $6 ); }'` echo "$ERRORLOG" >> $FILE_LOG
ERRORLOG=`/usr/sbin/cl-desktop --gui-progress $USER 2>&1` # display error by xmessage
# raise xmessage error if cl-desktop failed return 1
if [ "$?" -gt "0" ]; fi
then fi
# write error message to logfile return 0
echo "$ERRORLOG" >> $FILE_LOG }
# display error by xmessage
exit 1
fi
fi
exit 0

@ -1,5 +1,5 @@
#! /bin/sh #! /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"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with 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 # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
run_script() {
# clear kde cache # clear kde cache
/bin/rm -rf /var/tmp/kdecache-$USER /bin/rm -rf /var/tmp/kdecache-$USER
exit 0 return 0
}

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

@ -1,20 +1,33 @@
#!/bin/bash #!/bin/bash
# #
# Syncronize icon face from local user to kdm # 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 directory from kdm config
get_icon_face_dir() { get_icon_face_dir() {
local config_file=/usr/share/config/kdm/kdmrc local config_file=/usr/share/config/kdm/kdmrc
[[ -f $config_file ]] && sed -rn 's/^FaceDir=(.*)/\1/p' $config_file [[ -f $config_file ]] && sed -rn 's/^FaceDir=(.*)/\1/p' $config_file
} }
# copy .face.icon from user home directory to kdm face directory run_script() {
if [[ $DOMAIN_USER == "off" ]] && [[ -f $HOME_DIR/.face.icon ]]; then # copy .face.icon from user home directory to kdm face directory
FACE_DIR=$(get_icon_face_dir) if [[ $DOMAIN_USER == "off" ]] && [[ -f $HOME_DIR/.face.icon ]]; then
if [[ -n $FACE_DIR ]] && [[ -d $FACE_DIR ]];then FACE_DIR=$(get_icon_face_dir)
cp $HOME_DIR/.face.icon $FACE_DIR/${USER}.face if [[ -n $FACE_DIR ]] && [[ -d $FACE_DIR ]];then
fi cp $HOME_DIR/.face.icon $FACE_DIR/${USER}.face
fi fi
fi
exit 0 return 0
}

@ -1,5 +1,20 @@
#!/bin/bash #!/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 ) run_script() {
umount -l /home/$USER keyctl unlink $( keyctl request user $USER )
exit 0 umount -l /home/$USER
return 0
}

@ -139,18 +139,24 @@ if [[ $EXECDIR == /usr/share/calculate/xdm ]]; then
die "must specify option" die "must specify option"
fi fi
[[ -e ${EXECDIR} ]] || die "${EXECDIR} is not exists" [[ -e ${EXECDIR} ]] || die "${EXECDIR} is not exists"
FILELIST=$(find ${EXECDIR} -type f | sort) FILELIST=$(find ${EXECDIR} -type f | sort)
[[ $FILELIST ]] || warning "${EXECDIR} hasn't scripts" [[ $FILELIST ]] || warning "${EXECDIR} hasn't scripts"
gtk_background 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 ); }'` HOME_DIR=`getent passwd $USER | awk -F: '{ print( $6 ); }'`
for script in $FILELIST for script in $FILELIST
do 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 done
sleep_kill() sleep_kill()

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

Loading…
Cancel
Save