Как настроить параметры по умолчанию KDE для нового пользователя группы?

В соответствии с билетом в трекере smartctl это известная ошибка, и современные ядра отключают SAT ATA PASS-THROUGH для корпусов Seagate, когда в режиме UAS из-за проблем с некоторыми из них.

К счастью , корпус с id 0bc2:331a кажется полностью функциональным, если вы отключите это поведение.

Для этого вы должны добавить

quirks=0bc2:331a:

к модулю usb-storage. 5]

В качестве альтернативы вы можете отключить UAS. В этом случае используйте параметр

quirks=0bc2:331a:u

.

Я нашел ticket очень полезным для понимания того, как правильно применить этот модуль. [!d8 ]

4
задан 8 March 2012 в 22:33

3 ответа

Я закончил писать сценарий, который передает файлы точек, и после этого chown все это.

Edit:

Я перезаписал этот скрипт в bash о три года назад. И я использовал это в течение некоторого времени. Однако я не использовал этот скрипт в течение многих лет и больше не поддерживаю этот скрипт. Я не рассматривал этот скрипт сейчас, но я бы предположил, что он не имеет высокого качества, учитывая, что я написал его давно.

Основная идея - хранить базовые файлы точек на github и делать скрипт загружает их и исправляет имя пользователя и назначает соответствующие разрешения.

#!/bin/bash
# to get description use the -h flag

# You can see the structure of this code in emacs. For that eval the
# following lines:
# (mapc
#  (lambda (language-mode-hook)
#    (add-hook language-mode-hook 
#              (lambda ()
#                (make-local-variable 'outline-regexp)
#                (setq outline-regexp "^## ")
#                (make-local-variable 'outline-heading-end-regexp)
#                (setq outline-heading-end-regexp ":\n")
#                (outline-minor-mode 1))))
#    '(shell-script-mode-hook sh-mode-hook))
# this makes use of outline-minor-mode and the default keys are:
# C-c @ C-t    show top level structure
# C-c @ C-a    show all
# for more see the Outline menu.

# TODO:
# update routine documntation?

# exit after a single error:
set -e

# ===========
## preambula:

PROGNAME=${0##*/}
PROGVERSION=4.02
NoColors=false

Dependencies=false
Root=false
Internet=false
Localhost=false
Base=`logname`
Update=false
Source=boris
Autostart=false

usage()
{
cat << EO
Usage: $PROGNAME <user>

This script install bkubuntu kubuntu set of programs and settings. It
assumes the user have x86_64 archeticture.

It does back-up all the configs, but it keeps only the latest back-up
-- so if You'll run this script twice in a row -- You'll lose Your
files. You might want to back up the original thing manually.

All of the options except for -u/--update require root privilages.

Examples
========

To install bkubuntu for Yourself::

    cd /path/to/bkubuntu.bash 
    sudo ./bkubuntu.bash -i

To install Your bkubuntu to root::

    cd /path/to/bkubuntu.bash
    sudo ./bkubuntu.bash -r

To install bkubuntu from other user at localhost::

    cd /path/to/bkubuntu.bash
    sudo ./bkubuntu.bash -l -s <that user>

To update Your bkubuntu::

    bkubuntu.bash -u # provided bkubuntu.bash is in the PATH

Add -a if You want to have emacs, firefox, krusader, libreoffice
quickstart to run at start-up.

Options
=======

EO
cat << EO | column -s\& -t

  -i, --internet & fetchs bkubuntu from the internet and installs it for the current user
  -l, --localhost & fetchs bkubuntu from other user (-s)
  -a, --autostart & also turn on the autostart script (starts emacs, firefox, krusader at start up)
 
  -s, --source & source repository user, default to $Source
  -u, --update & updates Your bkubuntu git repos from the internet (should not be done under sudo)
  -r, --root & transfers subset of Your bkubuntu to the root
 
  -h, --help & show this output
  -v, --version & show version information
      --no-colors & disables coloring in output
EO
}


SHORTOPTS="hvars:ilu"
LONGOPTS="help,version,no-colors,autostart,root,source:,internet,localhost,update"

ARGS=$(getopt -s bash --options $SHORTOPTS --longoptions $LONGOPTS --name $PROGNAME -- "$@")
eval set -- "$ARGS"

while true; do
    case $1 in

        -a|--autostart)
            Autostart=true;;
        -r|--root)
            Root=true;;
        -s|--source)
            Source=$2; shift;;
        -i|--internet)
            Internet=true;;
        -l|--localhost)
            Localhost=true;;
        -u|--update)
            Update=true;;

        -h|--help)
            usage; exit 0;;
        -v|--version)
            echo "$PROGVERSION"; exit 0;;
           --no-colors)
            NoColors=true;;
        --)
            shift; break;;
        *)
            shift; break;;
    esac
    shift
done

if $NoColors; then
    BLUE=''
    GREEN=''
    RED=''
    BLACK=''
else
    BLUE='\033[94m'
    GREEN='\e[0;32m'
    RED='\033[91m'
    BLACK='\033[0m'
fi


# ===========
## functions:

autostart () {
    if [ -e /home/$Base/.kde/Autostart/bkubuntu_startup_simple.bash ]; then
        rm /home/$Base/.kde/Autostart/bkubuntu_startup_simple.bash
    fi
    if ! [ -d /home/$Base/.kde/Autostart ]; then
        mkdir /home/$Base/.kde/Autostart
    fi
    ln /home/$Base/cmp/devs/bk_automates/bkubuntu/bk_runs_at/bkubuntu_startup_simple.bash /home/$Base/.kde/Autostart/bkubuntu_startup_simple.bash
}


back-up_and_clean () {
    if [ -d "$Base~" ]; then
        rm -rf "$Base~"
    fi
    mkdir "$Base~"

    mv -T $Base "$Base~"
    mkdir $Base
    cd $Base

    echo -e "${RED}${PROGNAME}: ${GREEN}Done with backing up $Base (to $Base~).${BLACK}"
}


rebase () {

    # these files should have ho spaces!
    FILES="\
$PWD/.kde/share/config/plasma-desktoprc
$PWD/.kde/share/config/plasma-desktop-appletsrc
$PWD/.kde/share/apps/kfileplaces/bookmarks.xml
$PWD/.kde/share/config/krusaderrc
$PWD/.kde/share/apps/krusader/krbookmarks.xml
$PWD/.kde/share/apps/krusader/useractions.xml
$PWD/.kde/share/apps/krusader/krusaderui.rc
$PWD/.config/libreoffice/3/user/registrymodifications.xcu
$PWD/.kde/share/apps/kfileplaces/bookmarks.xml
$PWD/.kde/share/config/khotkeysrc
$PWD/.thunderbird/n8fe137g.default/secmod.db
$PWD/.thunderbird/n8fe137g.default/prefs.js
$PWD/.thunderbird/n8fe137g.default/extensions.ini
$PWD/.thunderbird/n8fe137g.default/extensions.sqlite
$PWD/.thunderbird/n8fe137g.default/panacea.dat
$PWD/.thunderbird/n8fe137g.default/startupCache/startupCache.8.little
$PWD/.mozilla/firefox/kkhrci0w.default/secmod.db
$PWD/.mozilla/firefox/kkhrci0w.default/prefs.js
$PWD/.mozilla/firefox/kkhrci0w.default/extensions.ini
$PWD/.mozilla/firefox/kkhrci0w.default/search.json
$PWD/.mozilla/firefox/kkhrci0w.default/extensions.sqlite
$PWD/.mozilla/firefox/kkhrci0w.default/startupCache/startupCache.8.little
$PWD/.mozilla/firefox/kkhrci0w.default/zotero/locate/engines.json"

    # root doesn't have all these files:
    if [ $Base = "root" ]; then
        FILES=`echo $FILES | perl -pe 's/ /\n/g' | perl -pe 's/.*(emacs|libreoffice|autokey|bkubuntu|mozilla|thunderbird).*//' | perl -pe 's/^\n//'`
    fi

    for fileName in $FILES; do
        sed -i "s/$Source/$Base/g" "$fileName"
    done

    echo -e "${RED}${PROGNAME}: ${GREEN}Done with rebasing.${BLACK}"

}


chown_logout () {

    # ------
    # chown:

    chown -R $Base $PWD
    echo -e "${RED}${PROGNAME}: ${GREEN}chown: everything went fine.\n    You may wish to restart now.${BLACK}"
    sleep 1

    # ---------------
    # finally logout:

    secsTilLogout=10
    while [ $secsTilLogout -gt 0 ]; do
        sleep 1 &
        clear
        echo -e "${RED}${PROGNAME}: ${GREEN}Done. Documentation for hotkeys is available at:\n    ~/bks/computer/HotKeyPoetry/index.html\n\n    Unless You kill me with Ctrl-c --\n    I'll logout computer in $secsTilLogout seconds.${BLACK}"
        secsTilLogout=$(( $secsTilLogout - 1 ))
        wait # the point of 'sleep 1 & -- wait' construct is not to take into account the time of `sleep' execution
    done

    qdbus org.kde.ksmserver /KSMServer org.kde.KSMServerInterface.logout 0 0 0

}


# ==========
## internet:

if $Internet; then

    # -------------
    # adding repos:

    echo -e \\n | sudo add-apt-repository ppa:kubuntu-ppa/ppa
    echo -e \\n | sudo add-apt-repository ppa:kubuntu-ppa/backports

    echo -e \\n | add-apt-repository ppa:cassou/emacs

    wget -q http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc -O- | sudo apt-key add -
    # perhaps I should add 
    # deb http://download.virtualbox.org/virtualbox/debian precise contrib
    # to /etc/apt/sources.list

    wget -q "http://deb.playonlinux.com/public.gpg" -O- | apt-key add -
    wget http://deb.playonlinux.com/playonlinux_squeeze.list -O /etc/apt/sources.list.d/playonlinux.list

    apt-get update

    echo -e "${RED}${PROGNAME}: ${GREEN}Done with repos.\n    Now the back-up phase...${BLACK}"
    sleep 1

    # -----------
    # installing:

    echo -e \\n | apt-get install emacs-snapshot konsole krusader okular kolourpaint4 smplayer vlc audacious gwenview k3b synaptic kopete keepassx xclip firefox thunderbird procps tree xsel libreoffice wmctrl git virtualbox playonlinux build-essential kubuntu-restricted-extras gfortran parallel sshfs ssh

    echo -e "${RED}${PROGNAME}: ${GREEN}Done with installing prerequisites.\n    Now the cloning stage...${BLACK}"
    sleep 1


    # --------------------
    # preparing the place:

    cd /home
    back-up_and_clean

    # -----------------
    # clonning configs:

    git clone https://github.com/bk322/bk_dots .
    cp -R .bkubuntu/* . # copying dir structure
    git clone https://github.com/bk322/bk_automates /home/$Base/cmp/devs/bk_automates

    echo -e "${RED}${PROGNAME}: ${GREEN}Done with cloning configs.${BLACK}"
    sleep 1

    # parallel:
    # dpkg -i /home/$Base/cmp/repo/parallel*.deb


    # -----------------
    # applying configs:

    # autostart?
    if $Autostart; then
        autostart
    fi

    # ----------
    # XULRunner:

    mv /home/$Base/cmp/repo/.mozilla .
    mv /home/$Base/cmp/repo/.thunderbird .

    rebase
    chown_logout

fi


# =========
## copying:

if $Localhost; then

    cd /home
    back-up_and_clean

    # ----------------------------------
    # cloning configs from user $Source:

    cd /home/$Base
    git clone /home/$Source .
    cp -R .bkubuntu/* . # copying dir structure
    git clone /home/$Source/cmp/devs/bk_automates /home/$Base/cmp/devs/bk_automates

    echo -e "${RED}${PROGNAME}: ${GREEN}Done with cloning configs from $Source.${BLACK}"
    sleep 1

    # -----------------
    # applying configs:

    # autostart?
    if $Autostart; then
        autostart
    fi

    # ----------
    # XULRunner:

    mv /home/$Base/cmp/repo/.mozilla .
    mv /home/$Base/cmp/repo/.thunderbird .

    # -----------------------
    # rebase, chown, restart:

    rebase
    chown_logout

fi


# ==========
## updating:

if $Update; then

    # -------------
    # update repos:

    cd /home/$Base
    git checkout -- . && git pull -u origin master

    cd /home/$Base/cmp/devs
    git checkout -- . && git pull -u origin master

    cd /home/$Base
    echo -e "${RED}${PROGNAME}: ${GREEN}Done with syncing gits.${BLACK}"
    sleep 1

    # ---------
    # rebasing:
    rebase

fi

# ======
## root:

if $Root; then

    cd /
    Base=root
    back-up_and_clean

    Source=`logname`
    cd /home/$Source
    listOfFiles=`git ls-files | perl -pe 's/.*(libreoffice|autokey|bkubuntu|mozilla|thunderbird).*//' | perl -pe 's/^\n//'`
    for File in $listOfFiles; do
        Parents=${File#/home/$Source/}
        cp --parents "$Parents" /root
    done


    # -----------------------
    # rebase, chown, restart:

    cd /root
    rebase
    chown_logout

fi
1
ответ дан 25 May 2018 в 13:48

Все в файле / etc / skel скопировано, поэтому, если вы включили .bashrc, либо он будет скопирован в домашний каталог нового пользователя и станет настройкой нового пользователя. Просмотрите скрытые файлы собственного домашнего каталога и посмотрите, что там. KDE и большинство других приложений будут размещать настройки для каждого пользователя.

ls -la /home/$(whoami)/
0
ответ дан 25 May 2018 в 13:48

Все в файле / etc / skel копируется, поэтому, если вы включили .bashrc или аналогично, он будет скопирован в домашний каталог нового пользователя и станет настройкой нового пользователя. Просмотрите скрытые файлы собственного домашнего каталога и посмотрите, что там. KDE и большинство других приложений будут размещать настройки для каждого пользователя.

ls -la /home/$(whoami)/
0
ответ дан 15 August 2018 в 20:03

Другие вопросы по тегам:

Похожие вопросы: