Strona 1 z 2

Zmiana wartości zmiennej PS1

: 25 marca 2013, 22:15
autor: sudoer
Hej.
Przeinstalowałem ostatnio Debiana (z płytki debian-live-6.0.7-i386-standard) i po włączeniu zainstalowanego na dysku systemu wita mnie niepokojące słówko ,,live'' przed nazwą użytkownika i reszty informacji z polecenia PS1. Eksport nowych wartości resetuje się po restarcie systemu.

Czy wszystko na pewno dobrze się zainstalowało? Jak mogę na stałe zmienić zmienną PS1?

: 26 marca 2013, 18:51
autor: Rafal_F
Możesz wkleić

Kod: Zaznacz cały

export PS1="wartosc zmiennej"
Do pliku:

Kod: Zaznacz cały

~/.bashrc

: 27 marca 2013, 17:23
autor: sudoer
Czy nie spotkał się ktoś z występowaniem tego słówka w przypadku źle zainstalowanego systemu? Walcząc z sshd oraz transmission zauważyłem że wszystkie demony mają problemy z dostępem do plików. Nie mogę sprawdzić ich statusów (brak dostępu do PID), a syslogng nie tworzy logów.

: 27 marca 2013, 17:38
autor: marcin1982
Przeinstaluj pakiet z poziomu terminala:

Kod: Zaznacz cały

libenv-ps1-perl
Podaj wszelkie informacje jakie będą wyświetlane podczas reinstalacji.
Podaj też wyniki takich poleceń:

Kod: Zaznacz cały

whoami

Kod: Zaznacz cały

echo $HOSTNAME

: 27 marca 2013, 17:50
autor: sudoer
marcin1982 pisze:Przeinstaluj pakiet z poziomu terminala:

Kod: Zaznacz cały

libenv-ps1-perl
Podaj wszelkie informacje jakie będą wyświetlane podczas reinstalacji.
Pakiet nie był wcześniej zainstalowany, podczas instalacji nie pokazało się nic specjalnego.

Kod: Zaznacz cały

Unpacking libenv-ps1-perl (from .../libenv-ps1-perl_0.06-1_all.deb) ...Processing triggers for man-db ...
Setting up libenv-ps1-perl (0.06-1) ...
marcin1982 pisze: Podaj też wyniki takich poleceń:

Kod: Zaznacz cały

whoami

Kod: Zaznacz cały

echo $HOSTNAME
Nazwa użytkownika oraz komputera, nic niepokojącego.

: 27 marca 2013, 17:58
autor: marcin1982
Pokaż jeszcze:

Kod: Zaznacz cały

echo $PS1

Kod: Zaznacz cały

cat /etc/bash.bashrc

: 28 marca 2013, 02:22
autor: sudoer
Tak tak, jeśli zmienię sobie .bashrc to przestawi mi się i PS1 (napisał o tym już Rafal_F) ale teraz martwi mnie rzecz opisana przeze mnie 2 posty wyżej - problem z demonami. Wydaje mi się, że coś jednak się skopało i będę musiał znowu przeinstalować system, czyżby Debian nie lubił być instalowany z nośników pendrive?

: 28 marca 2013, 06:18
autor: marcin1982
No to przecież nie chodzi o to, żebyś zastosował półśrodek w twoim .bashrc. Chciałem sprawdzić co jest nie tak w globalnej konfiguracji. Skoro jednak wyniki komend to:
Tak tak
to nie sprawdzimy co naprawdę nie gra i czy zmiana na wartości poprawne zmeni cokolwiek ...

: 28 marca 2013, 14:46
autor: sudoer
Minus dla mnie za brak wiary w ludzi, przepraszam.

PS1 wygląda tak:

Kod: Zaznacz cały

\[\e]0;(live)\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\u@\h:\w\$
/etc/bash.bashrc

Kod: Zaznacz cały

# System-wide .bashrc file for interactive bash(1) shells.

# To enable the settings / commands in this file for login shells as well,
# this file has to be sourced in /etc/profile.


# If not running interactively, don't do anything
[ -z "$PS1" ] && return


# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize


# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then
    debian_chroot=$(cat /etc/debian_chroot)
fi


# set a fancy prompt (non-color, overwrite the one in /etc/profile)
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '


# Commented out, don't overwrite xterm -T "title" -n "icontitle" by default.
# If this is an xterm set the title to user@host:dir
#case "$TERM" in
#xterm*|rxvt*)
#    PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD}\007"'
#    ;;
#*)
#    ;;
#esac


# enable bash completion in interactive shells
#if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
#    . /etc/bash_completion
#fi


# if the command-not-found package is installed, use it
if [ -x /usr/lib/command-not-found -o -x /usr/share/command-not-found ]; then
        function command_not_found_handle {
                # check because c-n-f could've been removed in the meantime
                if [ -x /usr/lib/command-not-found ]; then
                   /usr/bin/python /usr/lib/command-not-found -- $1
                   return $?
                elif [ -x /usr/share/command-not-found ]; then
                   /usr/bin/python /usr/share/command-not-found -- $1
                   return $?
                else
                   return 127
                fi
        }
fi
/etc/debian_chroot

Kod: Zaznacz cały

live

Czyżby było tak jak obstawiałem, zamiast zainstalować system instalator przekopiował mi wersję live na dysk?

: 28 marca 2013, 15:20
autor: Rafal_F
sudoer pisze:Czyżby było tak jak obstwiałem, zamiast zainstalować system instalator przekopiował mi wersję live na dysk?
Okazuje się, że to możliwe. Według dokumentacji są 3 metody instalacji, jedną z nich jest:
http://live.debian.net/project/about/ pisze:"Live" Debian Installer: This is a Debian Live image with a separate kernel and initrd which (when selected from the appropriate bootloader) launches into an instance of the Debian Installer.
585

Installation will proceed in an identical fashion to the "normal" installation described above, but at the actual package installation stage, instead of using debootstrap to fetch and install packages, the live filesystem image is copied to the target. This is achieved with a special udeb called live-installer.
586

After this stage, the Debian Installer continues as normal, installing and configuring items such as bootloaders and local users, etc.
Proponuje dokładnie zapoznać się z dokumentacja i poczytanie o tym, czym jest projekt debian live.