Commit a30a3a7d authored by Lior Spach's avatar Lior Spach

le-italc-config: Refs #1372 Run script after generate func (multiterminal)

Signed-off-by: Lior Spach's avatarLior Spach <ls12@inf.ufpr.br>
parent d00682a6
...@@ -159,38 +159,32 @@ generate_script_monoterminal_client () { ...@@ -159,38 +159,32 @@ generate_script_monoterminal_client () {
generate_script_multiterminal () { generate_script_multiterminal () {
#Create a script in profile.d #Create a script in profile.d
local g_file="$SCRIPT_MULT_PATH" local g_file="$SCRIPT_MULT_PATH"
echo "#!/bin/sh" > $g_file
echo "#Privileged Users don't run ica" >> $g_file
echo "if [ \"\$USER\" = \"admin\" ]; then" >> $g_file
echo " return 0" >> $g_file
echo "fi" >> $g_file
echo "#Do not execute ica on logout" >> $g_file
echo "if ps -u \$USER -o comm | grep \"^ica\$\"; then" >> $g_file
echo " return 0" >> $g_file
echo "fi" >> $g_file
echo "#Resolve Port" >> $g_file
echo "PORT=\"\$(( 11000 + \$(echo \$DISPLAY | awk -F \":\" '{print \$NF}' | cut -b 1) ))\"" >> $g_file
(echo "#!/bin/sh"
echo "#Privileged Users don't run ica"
echo "if [ \"\$USER\" = \"admin\" ]; then"
echo " return 0"
echo "fi"
echo
echo "#Do not execute ica on logout"
echo "if ps -u \$USER -o comm | grep \"^ica\$\"; then"
echo " return 0"
echo "fi"
echo
echo "#Resolve Port"
echo "PORT=\"\$(( 11000 + \$(echo \$DISPLAY | awk -F \":\" '{print \$NF}' | cut -b 1) ))\""
echo
echo "#ReSet the default port server for teacher(mobility to teachers computer)" echo "#ReSet the default port server for teacher(mobility to teachers computer)"
echo "if [ \"\$USER\" = \"professor\" ]; then" echo "if [ \"\$USER\" = \"professor\" ]; then"
echo " italc_conf=\"/etc/xdg/iTALC Solutions/iTALC.conf\"" echo " imc -setconfigvalue Network/CoreServerPort=\${PORT}"
echo " if [ -e \"italc_conf\" ]; then #if file exist\""
echo " line=\$(sed -n '/CoreServerPort=/=' \"\$italc_conf\")"
echo " sed -i \"/CoreServerPort=/d\" \"\$italc_conf\""
echo " sed -i \"\${line}iCoreServerPort=\${PORT}\" \"\$italc_conf\""
echo " fi"
echo "fi" echo "fi"
echo
echo "#Execute ICA"
echo "if [ -n \"\$PORT\" ]; then"
echo " ica -port \$PORT &"
echo "fi") > $g_file
echo "#Execute ICA" >> $g_file
echo "if [ -n \"\$PORT\" ]; then" >> $g_file
echo " ica -port \$PORT &" >> $g_file
echo "fi" >> $g_file
chmod +x $g_file chmod +x $g_file
} }
...@@ -253,11 +247,12 @@ config_multiterminal () { ...@@ -253,11 +247,12 @@ config_multiterminal () {
#Release public key #Release public key
sudo -u professor chmod 755 /etc/italc/keys/public -R sudo -u professor chmod 755 /etc/italc/keys/public -R
imc -setconfigvalue Authentication/LogonAuthenticationEnabled=0 #Don't ask for login to enter italc #Set config and create autorun script
generate_script_multiterminal #ica autorun imc -setconfigvalue Authentication/LogonAuthenticationEnabled=0 #Don't ask for login to enter italc. Only teacher can read private key.
generate_script_multiterminal
if (who --users | awk -F " " '{print $1}' | grep -q "^professor$"); then #If teacher is logged in execute ica(no need for relogin) if (who --users | awk -F " " '{print $1}' | grep -q "^professor$"); then #If teacher is logged in execute autorun script
su professor -c "ica & disown" su professor -c ".${SCRIPT_MULT_PATH}" #Run script, so teacher doesn't need to relogin
fi fi
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment