среда, 24 июля 2013 г.

виртуальная клавиатура kvkbd и логин в linux

в продолжение темы про f2fs задумал я сделать логин к нетбуку, а то там клава сломана.

В силу того, что OS Slackware Linux, то я нагуглил слакобилд. Вот он:


#!/bin/sh
#-- kvkbd for Slackware --
# Build script by Phantom X 
# Suggested usage: $ kvkbd.SlackBuild 2>&1 | tee build.log
#--
# Copyright 2008, 2009, 2010, 2011 Phantom X, Goiania, Brazil.
# Copyright 2006 Martijn Dekker, Groningen, Netherlands.
#
# Redistribution and use of this script, with or without modification, is
# permitted provided that the following conditions are met:
#
# 1. Redistributions of this script must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR `AS IS'' AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

# http://www.kde-apps.org/content/show.php/Kvkbd?content=56019

PACKAGER_ID=${PACKAGER_ID:-$USER}
PACKAGER=${PACKAGER:-$USER@$HOSTNAME}

# Set YES for native build with gcc >= 4.2
SB_NATIVE=${SB_NATIVE:-NO}

# Set to YES to replicate slackbuild and patches
SB_REP=${SB_REP:-YES}

CWD=$(pwd)
TMP=${TMP:-/tmp}
if [ ! -d ${TMP} ]; then
  mkdir -p ${TMP}
fi

NAME=kvkbd
PKG=${PKG:-${TMP}/package-${NAME}}

VERSION=${VERSION:-0.6}
if [ "${SB_NATIVE}" = "YES" ] ;then
  ARCH=${ARCH:-$(uname -m)}
else
  ARCH=${ARCH:-x86_64}
fi
if [ "${ARCH}" = "x86_64" ] ;then
  SLKTARGET=${SLKTARGET:-x86_64}
else
  SLKTARGET=${SLKTARGET:-i486}
fi
SLKDTARGET=${SLKDTARGET:-slackware}
BUILD=${BUILD:-1}
NJOBS=${NJOBS:-$(( $(getconf _NPROCESSORS_ONLN) + 1 ))}
DOCDIR=${PKG}/usr/doc/${NAME}-${VERSION}
SBDIR=${PKG}/usr/src/slackbuilds/kde-apps/${NAME}
PKGDEST=${PKGDEST:-${CWD}}
PKGFORMAT=${PKGFORMAT:-tgz}
PKGNAME=${NAME}-$(echo ${VERSION} | tr - . )-${ARCH}-${BUILD}${PACKAGER_ID}

DATE=$(LC_ALL=C date +%d-%b-%Y)

SRCDIR=${NAME}-${VERSION}
SRCARCHIVE=94374-${SRCDIR}.tar.bz2

DL_PROG=${DL_PROG:-wget}
DL_TO=${DL_TO:-5}
DL_OPTS=${DL_OPTS:-"--timeout=${DL_TO}"}
DL_URL="http://www.kde-apps.org/CONTENT/content-files/${SRCARCHIVE}"

# if source is not present, download in source rootdir if possible
test -r ${CWD}/${SRCARCHIVE} || ${DL_PROG} ${DL_OPTS} ${DL_URL} || exit 1

if [ "${SB_NATIVE}" = "YES" ] ;then
  SLKCFLAGS="-O2 -march=native -mtune=native -pipe"
  [ "${SB_ECFLAGS}" ] && SLKCFLAGS="${SLKCFLAGS} ${SB_ECFLAGS}"
else
  case "${ARCH}" in
    i[3-6]86) SLKCFLAGS="-O2 -march=${ARCH} -mtune=i686"
                 ;;
    x86_64) SLKCFLAGS="-O2 -fPIC"
                 ;;
    s390|*) SLKCFLAGS="-O2"
                 ;;
  esac
fi
if [ "${ARCH}" = "x86_64" ] ;then
  LIBDIRSUFFIX="64"
  SLKCFLAGS="${SLKCFLAGS} -fPIC"
else
  LIBDIRSUFFIX=""
fi

# Set the config option variables if they are not already set:
[ -r ../KDE.options ] && source ../KDE.options
[ -r /etc/profile.d/kde4.sh ] && source /etc/profile.d/kde4.sh

_kde4_prefix=${_kde4_prefix:-/usr}
_kde4_sysconfdir=${_kde4_sysconfdir:-/etc/kde}
_kde4_libdir=${_kde4_libdir:-/usr/lib${LIBDIRSUFFIX}}
_kde4_libexecdir=${_kde4_libexecdir:-/usr/libexec/kde4}
_kde4_datadir=${_kde4_datadir:-/usr/share}
_kde4_sharedir=${_kde4_sharedir:-/usr/share}
_kde4_iconsdir=${_kde4_iconsdir:-${_kde4_sharedir}/icons}
_kde4_configdir=${_kde4_configdir:-${_kde4_sharedir}/config}
_kde4_appsdir=${_kde4_appsdir:-${_kde4_sharedir}/kde4/apps}
_kde4_docdir=${_kde4_docdir:-${_kde4_prefix}/doc}
_kde4_bindir=${_kde4_bindir=:-${_kde4_prefix}/bin}
_kde4_sbindir=${_kde4_sbindir:-${_kde4_prefix}/sbin}
_kde4_includedir=${_kde4_includedir:-${_kde4_prefix}/include/kde4}
_kde4_buildtype=${_kde4_buildtype:-release}
_kde4_macros_api=${_kde4_macros_api:-2}

if [ -d ${PKG} ]; then
  # Clean up a previous build
  rm -rf ${PKG}
fi
mkdir -p ${PKG}

unset QTDIR QTINC QTLIB
export QTDIR=$(qmake-qt4 -query QT_INSTALL_PREFIX)
PATH="$(qmake-qt4 -query QT_INSTALL_BINS):${PATH}" ; export PATH

cd ${TMP}
rm -rf ${SRCDIR}
tar -xvf ${CWD}/${SRCARCHIVE} || exit 1
cd ${SRCDIR} || exit 1

chmod -R u+w,go+r-w,a-s .

# zcat ${CWD}/${NAME}.patch.gz | patch -p0 -E --backup --verbose || exit 1

export CFLAGS="${SLKCFLAGS}"
export CXXFLAGS="${SLKCFLAGS}"
export FFLAGS="${SLKCFLAGS}"

mkdir -p build
( cd build || exit 1

  cmake .. \
    -DCMAKE_EXE_LINKER_FLAGS="$CFLAGS -lX11" \
    -DCMAKE_INSTALL_PREFIX:PATH=${_kde4_prefix} \
    -DSYSCONF_INSTALL_DIR:PATH=${_kde4_sysconfdir} \
    -DINCLUDE_INSTALL_DIR:PATH=${_kde4_includedir} \
    -DLIB_INSTALL_DIR:PATH=${_kde4_libdir} \
    -DLIB_SUFFIX=${LIBDIRSUFFIX} \
    -DLIBEXEC_INSTALL_DIR:PATH=${_kde4_libexecdir} \
    -DDATA_INSTALL_DIR:PATH=${_kde4_appsdir} \
    -DMAN_INSTALL_DIR:PATH=/usr/man \
    -DCMAKE_BUILD_TYPE=${_kde4_buildtype} \
    -DBUILD_SHARED_LIBS:BOOL=ON \
    -DCMAKE_SKIP_RPATH:BOOL=ON \
    -DCMAKE_VERBOSE_MAKEFILE=ON \
    || exit 1

  make -j${NJOBS} || make || exit 1
  make install/fast DESTDIR=${PKG} || exit 1

) || exit 1

find ${PKG} | xargs file | grep -e "executable" -e "shared object" | grep ELF \
  | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null

# Add a documentation directory:
mkdir -p ${DOCDIR}
cp -a \
  AUTHORS COPYING ChangeLog README TODO ${CWD}/ChangeLog.SB \
  ${DOCDIR}/
find ${DOCDIR}/ -type d -print0 | xargs -0 chmod 0755
find ${DOCDIR}/ -type f -print0 | xargs -0 chmod 0644

# Compress and link manpages, if any:
if [ -d ${PKG}/usr/share/man ]; then
  mv ${PKG}/usr/share/man ${PKG}/usr/man
  rmdir ${PKG}/usr/share
fi
if [ -d ${PKG}/usr/man ]; then
  ( cd ${PKG}/usr/man
    for manpagedir in $(find . -type d -name "man*") ; do
      ( cd ${manpagedir}
        for eachpage in $( find . -type l -maxdepth 1) ; do
          ln -s $( readlink ${eachpage} ).gz ${eachpage}.gz
          rm -f ${eachpage}
        done
        gzip -9 *.?
        # Prevent errors
        rm -f *.gz.gz
      )
    done
  )
fi

mkdir -p ${PKG}/install
cat ${CWD}/slack-desc > ${PKG}/install/slack-desc
cat ${CWD}/slack-required > ${PKG}/install/slack-required

sed -i "s|_PACKAGER|${PACKAGER}|g; s|_BUILD_DATE|${DATE}|g" \
       ${PKG}/install/slack-desc

if [ "${SB_REP}" = "YES" ] ;then
  # Replicate slackbuild and patches
  mkdir -p ${SBDIR}
  install -m0644 ${CWD}/slack-desc ${CWD}/slack-required ${CWD}/ChangeLog.SB \
                 ${SBDIR}/
  install -m0755 ${CWD}/${NAME}.SlackBuild \
                 ${SBDIR}/${NAME}.SlackBuild
fi

# Build package:
set +o xtrace # no longer print commands upon execution

ROOTCOMMANDS="set -o errexit -o xtrace ; cd ${PKG} ;
  /bin/chown --recursive root:root . ;"

ROOTCOMMANDS="${ROOTCOMMANDS}
  /sbin/makepkg --linkadd y --chown n ${PKGDEST}/${PKGNAME}.${PKGFORMAT} "

if test ${UID} = 0; then
  eval ${ROOTCOMMANDS}
  set +o xtrace
elif test "$(type -t fakeroot)" = 'file'; then
  echo -e "\e[1mEntering fakeroot environment.\e[0m"
  echo ${ROOTCOMMANDS} | fakeroot
else
  echo -e "\e[1mPlease enter your root password.\e[0m (Consider installing fakeroot.)"
  /bin/su -c "${ROOTCOMMANDS}"
fi

# Clean up the extra stuff:
if [ "$1" = "--cleanup" ]; then
  echo "Cleaning..."
  if [ -d ${TMP}/${SRCDIR} ]; then
    rm -rf ${TMP}/${SRCDIR} && echo "${TMP}/${SRCDIR} cleanup completed"
  fi
  if [ -d ${PKG} ]; then
    rm -rf ${PKG} && echo "${PKG} cleanup completed"
  fi
  rmdir ${TMP} && echo "${TMP} cleanup completed"
fi
exit 0
скрипт несколько исправлен:

1. ставится kvkbd (слакобилд можно нагуглить, но он сейчас сломан. Что-бы его починить, надо в опции cmake добавить -DCMAKE_EXE_LINKER_FLAGS="$CFLAGS -lX11", тогда собирается и работает, исправленный скрипт выше)

2. в /etc/kde/kdm/kdmrc меняется
-UseTheme=true
+UseTheme=false

3. в /etc/kde/kdm/Xsetup +/usr/bin/kvkbd --loginhelper &
тогда при логине и при перелогине включается клава, и даже набирается. Но вот если усыпить девайс, то хрен там :-( Срабатывает блокировка. Хоть свою пиши на zenity :-( (но там нужно кучу костылей, что-бы её невозможно было-бы вырубить без пароля).
Пока пришлось сделать беспарольный вход, но это меня расстраивает.

Связанная тема на ЛОРе http://www.linux.org.ru/forum/desktop/9379797


Комментариев нет:

Отправить комментарий