grml-screen/grml-init-screen: no longer use vt-is-UTF8 but instead default to UTF...
[grml-scripts-core.git] / usr_bin / grml-screen
index 4a9a33e..ddc1a98 100755 (executable)
@@ -25,14 +25,15 @@ if [ ! -d "/var/run/screen/S-$USER" ]; then
             echo $MY_PID_ >$PID_FILE_
             PID_FILE_CREATED_="true"
             break
+        else
+            PID_FILE_CREATED_="error"
         fi
         sleep 0.25
     done
 fi
 if [ $PID_FILE_CREATED_ = "true" ]; then
-    if [ -f $PID_FILE_ ]; then
-        # FORK BEGIN
-        (
+    # FORK BEGIN
+    (
         for i in `seq 40`; do   # 40*0.25 = 10 seconds
             if [ ! -d "/var/run/screen/S-$USER" ]; then
                 sleep 0.25  # educated guess
@@ -44,25 +45,27 @@ if [ $PID_FILE_CREATED_ = "true" ]; then
             rm $PID_FILE_
             lockfile-remove $PID_FILE_
         fi
-        )&
-        # FORK END
-    else
-        SLEEP_TIME_="$(( $$ % 5 * 5 + 5 ))"
-        echo "grml-screen: Error could not create lockfile! (sleeping for $SLEEP_TIME_)"
-        sleep $SLEEP_TIME_
-    fi
+    )&
+    # FORK END
+elif [ $PID_FILE_CREATED_ = "error" ]; then
+    SLEEP_TIME_="$(( $$ % 5 * 5 + 5 ))"
+    echo "grml-screen: Error could not create lockfile! (sleeping for $SLEEP_TIME_)" >&2
+    sleep $SLEEP_TIME_
+elif [ $PID_FILE_CREATED_ = "false" ]; then
+    echo "nothing to do" &>/dev/null
+else
+    echo "grml-screen: internal error - PID_FILE_CREATED_ == \"$PID_FILE_CREATED_\"" >&2
 fi
 
 # now run screen with config
   cd $HOME     # important for e.g. hardcopy-feature
-  # do we have a utf8 enabled terminal?
-  [ -x /usr/bin/vt-is-UTF8 ] && /usr/bin/vt-is-UTF8 -q && UTF='-U'
+
   if [ `id -u` = 0 ] ; then
-    exec screen $UTF -c /etc/grml/screenrc
+    exec screen -U -c /etc/grml/screenrc
   elif [ -r "$HOME/.screenrc" ] ; then
-    exec screen $UTF -c "$HOME/.screenrc"
+    exec screen -U -c "$HOME/.screenrc"
   else
-    exec screen $UTF -c /etc/grml/screenrc_grml
+    exec screen -U -c /etc/grml/screenrc_grml
   fi
 
 ## END OF FILE #################################################################