Linux-在SDDM中将自定义脚本置于自定义加载状态

Linux-在SDDM中将自定义脚本置于自定义加载状态,linux,ubuntu,kde,linux-mint,Linux,Ubuntu,Kde,Linux Mint,如果你能帮忙,我将不胜感激。我正在尝试将我的Google Chrome缓存移动到RAM磁盘,并按照说明进行操作。它说,我需要以这种方式将脚本放入我的显示管理器配置中: GDM(Gnome显示管理器)或MDM-/etc/MDM/PostSession/Default 在“退出0”行之前添加“/etc/init.d/ramdisksavestore stop” LightDM-/etc/LightDM/LightDM.conf 在“[SeatDefaults]”部分的末尾添加“会话清理脚本=/etc

如果你能帮忙,我将不胜感激。我正在尝试将我的Google Chrome缓存移动到RAM磁盘,并按照说明进行操作。它说,我需要以这种方式将脚本放入我的显示管理器配置中:

GDM(Gnome显示管理器)或MDM-/etc/MDM/PostSession/Default 在“退出0”行之前添加“/etc/init.d/ramdisksavestore stop”

LightDM-/etc/LightDM/LightDM.conf 在“[SeatDefaults]”部分的末尾添加“会话清理脚本=/etc/init.d/ramdisksaverestore stop”

但是我使用LinuxMint18KDE(基于Ubuntu)和SDDM,我不知道应该把我的脚本放在哪里(我指的是它的文件和行)。有什么帮助吗

也许我应该把它放在/usr/share/sddm/scripts/Xsession中,但是放在哪里以及如何放呢

#! /bin/sh
# Xsession - run as user

# This file is extracted from kde-workspace (kdm/kfrontend/genkdmconf.c)
# Copyright (C) 2001-2005 Oswald Buddenhagen <ossi@kde.org>

session=$1

# Note that the respective logout scripts are not sourced.
case $SHELL in
  */bash)
    [ -z "$BASH" ] && exec $SHELL $0 "$@"
    set +o posix
    [ -f /etc/profile ] && . /etc/profile
    if [ -f $HOME/.bash_profile ]; then
      . $HOME/.bash_profile
    elif [ -f $HOME/.bash_login ]; then
      . $HOME/.bash_login
    elif [ -f $HOME/.profile ]; then
      . $HOME/.profile
    fi
    ;;
*/zsh)
    [ -z "$ZSH_NAME" ] && exec $SHELL $0 "$@"
    [ -d /etc/zsh ] && zdir=/etc/zsh || zdir=/etc
    zhome=${ZDOTDIR:-$HOME}
    # zshenv is always sourced automatically.
    [ -f $zdir/zprofile ] && . $zdir/zprofile
    [ -f $zhome/.zprofile ] && . $zhome/.zprofile
    [ -f $zdir/zlogin ] && . $zdir/zlogin
    [ -f $zhome/.zlogin ] && . $zhome/.zlogin
    emulate -R sh
    ;;
  */csh|*/tcsh)
    # [t]cshrc is always sourced automatically.
    # Note that sourcing csh.login after .cshrc is non-standard.
    xsess_tmp=`mktemp /tmp/xsess-env-XXXXXX`
    $SHELL -c "if (-f /etc/csh.login) source /etc/csh.login; if (-f ~/.login) source ~/.login; /bin/sh -c 'export -p' >! $xsess_tmp"
    . $xsess_tmp
    rm -f $xsess_tmp
    ;;
  *) # Plain sh, ksh, and anything we do not know.
    [ -f /etc/profile ] && . /etc/profile
    [ -f $HOME/.profile ] && . $HOME/.profile
    ;;
esac

[ -f /etc/xprofile ] && . /etc/xprofile
[ -f $HOME/.xprofile ] && . $HOME/.xprofile

# run all system xinitrc shell scripts.
if [ -d /etc/X11/xinit/xinitrc.d ]; then
  for i in /etc/X11/xinit/xinitrc.d/* ; do
  if [ -x "$i" ]; then
    . "$i"
  fi
  done
fi

# Load Xsession scripts
# OPTIONFILE, USERXSESSION, USERXSESSIONRC and ALTUSERXSESSION are required
# by the scripts to work
xsessionddir="/etc/X11/Xsession.d"
OPTIONFILE=/etc/X11/Xsession.options
USERXSESSION=$HOME/.xsession
USERXSESSIONRC=$HOME/.xsessionrc
ALTUSERXSESSION=$HOME/.Xsession

if [ -d "$xsessionddir" ]; then
    for i in `ls $xsessionddir`; do
        script="$xsessionddir/$i"
        echo "Loading X session script $script"
        if [ -r "$script"  -a -f "$script" ] && expr "$i" : '^[[:alnum:]_-]\+$' > /dev/null; then
            . "$script"
        fi
    done
fi

if [ -d /etc/X11/Xresources ]; then
  for i in /etc/X11/Xresources/*; do
    [ -f $i ] && xrdb -merge $i
  done
elif [ -f /etc/X11/Xresources ]; then
  xrdb -merge /etc/X11/Xresources
fi
[ -f $HOME/.Xresources ] && xrdb -merge $HOME/.Xresources

case $session in
  "")
    exec xmessage -center -buttons OK:0 -default OK "Sorry, $DESKTOP_SESSION is no valid session."
    ;;
  *)
    eval exec "$session"
    ;;
esac
exec xmessage -center -buttons OK:0 -default OK "Sorry, cannot execute $session. Check $DESKTOP_SESSION.desktop."
#/垃圾箱/垃圾箱
#Xsession-以用户身份运行
#此文件从kde工作区(kdm/kfrontend/genkdmconf.c)中提取
#版权所有(C)2001-2005 Oswald Buddenhagen
会话=$1
#请注意,相应的注销脚本没有来源。
案例$SHELL in
*/(猛击)
[-z“$BASH”]&&exec$SHELL$0“$@”
set+o posix
[-f/etc/profile]&&&/等/简介
如果[-f$HOME/.bash_profile];然后
. $HOME/.bash\u配置文件
elif[-f$HOME/.bash_login];然后
. $HOME/.bash\u登录
elif[-f$HOME/.profile];然后
. $HOME/.profile
fi
;;
*/zsh)
[-z“$ZSH_NAME”]&&exec$SHELL$0“$@”
[d/etc/zsh]&&zdir=/etc/zsh | zdir=/etc
zhome=${ZDOTDIR:-$HOME}
#zshenv总是自动来源。
[-f$zdir/zprofile]&&&$zdir/zprofile
[-f$zhome/.zprofile]&&&$zhome/.zprofile
[-f$zdir/zlogin]&&&$zdir/zlogin
[-f$zhome/.zlogin]&&&$zhome/.zlogin
仿效-rsh
;;
*/csh |*/tcsh)
#[t]cshrc始终自动来源。
#请注意,sourcing csh.login after.cshrc是非标准的。
xsss_tmp=`mktemp/tmp/xsss-env-XXXXXX`
$SHELL-c“如果(-f/etc/csh.login)source/etc/csh.login;如果(-f~/.login)source~/.login;/bin/sh-c'export-p'>!$xsess\u tmp”
. $xsess_tmp
rm-f$xsess_tmp
;;
*)#普通sh、ksh和任何我们不知道的东西。
[-f/etc/profile]&&&/等/简介
[-f$HOME/.profile]&&&$HOME/.profile
;;
以撒
[-f/etc/xprofile]&&&/etc/xprofile
[-f$HOME/.xprofile]&&&$HOME/.xprofile
#运行所有系统xinitrc shell脚本。
if[-d/etc/X11/xinit/xinitrc.d];然后
对于/etc/X11/xinit/xinitrc.d/*中的i;做
如果[-x“$i”];然后
. “$i”
fi
完成
fi
#加载Xsession脚本
#OPTIONFILE、USERXSESSION、USERXSESSIONRC和ALTUSERXSESSION是必需的
#通过脚本来工作
xsessionddir=“/etc/X11/Xsession.d”
OPTIONFILE=/etc/X11/Xsession.options
USERXSESSION=$HOME/.xsession
USERXSESSIONRC=$HOME/.xsessionrc
ALTUSERXSESSION=$HOME/.Xsession
如果[-d“$xsessionddir”];然后
对于'ls$xsessionddir'中的i;做
script=“$xsessionddir/$i”
echo“加载X会话脚本$script”
如果[-r“$script”-a-f“$script”]和&expr“$i”:“^[:alnum:][u-]\+$”>/dev/null;然后
. “$script”
fi
完成
fi
if[-d/etc/X11/Xresources];然后
对于/etc/X11/Xresources/*中的i;做
[-f$i]&&xrdb-合并$i
完成
elif[-f/etc/X11/Xresources];然后
xrdb-merge/etc/X11/Xresources
fi
[-f$HOME/.Xresources]&&xrdb-merge$HOME/.Xresources
案例$session in
"")
exec xmessage-中心-按钮确定:0-默认确定“抱歉,$DESKTOP\u会话不是有效会话。”
;;
*)
eval exec“$session”
;;
以撒
exec xmessage-center-buttons OK:0-default OK“对不起,无法执行$session。请检查$DESKTOP\u session.DESKTOP。”

事实证明,最好的决定是使用PSD(),不要担心任何事情,它会自行解决所有问题