From: Michael Shigorin <mike@osdn.org.ua> To: ALT Linux Community general discussions <community@lists.altlinux.org> Subject: Re: [Comm] Доработка после установки Date: Fri, 7 Aug 2009 00:23:16 +0300 Message-ID: <20090806212316.GC6046@osdn.org.ua> (raw) In-Reply-To: <4A7B3957.2070704@ikir.ru> [-- Attachment #1: Type: text/plain, Size: 588 bytes --] On Fri, Aug 07, 2009 at 09:13:11AM +1300, Arcady Ivanov wrote: > Что такое here-documents? cat > FILE << __EOF__ line1 line2 line3 __EOF__ См. тж. bash(1) и практически любую книжку с упоминанием UNIX shell, особенно рекомендую "UNIX: универсальная среда программирования" (Керниган, Пайк). > Забыл указать, что цель скрипта - ликвидировать однообразную > ручную работу при настройке традиционных для меня вариантов > систем и заодно запомнить в коде все нюансы настройки, которые > имеют тенденцию забываться. Ага... :) -- -rwxrwxr-x 1 mike mike 3670 Feb 19 1999 rh5.1clean [-- Attachment #2: rh5.1clean --] [-- Type: text/plain, Size: 3670 bytes --] #!/bin/bash # Red Hat Linux 5.1 (Manhattan) doctor :) # they at RedHat think we need just everything. But we often don't, # especially those of us who are short of disk. # And of course, our users *do* need to work with floppies and CDs # So, I tried to make the script crawl out and fix some annoying things. # Among them I'd like to implement these: # - /usr cleanup (man, doc, share...) # - colour ls \_ done by # - .inputrc /~ EayCyrillic in fact # - my own fd/CD scripts, together with # - some /dev/fd* entries & permission fix # - cyrillization of bash and mc at least... # ...of course, this could only be run by root to accomplish. EASYCYRILLIC="./easy-cyrillic" TIMEREGION="Europe" TIMEZONE="Kiev" ask_yes () { echo -n "$1 [Y/n]?" read answer case $answer in n|N|no) OK=;; # empty string *) OK=yes;; # just not empty :) esac } ask_no () { echo -n "$1 [N/y]?" read answer case $answer in y|Y|yes) OK=yes;; *) OK=;; esac } clear echo "I'm gonna clean your disk a bit. Here's your disk stats:" df -h -t ext2 echo "I think there may be some extra files on your disk..." ask_no "So, should I proceed" if [ $OK ]; then echo "Proceeding..." else echo "Maybe next time?" exit 1 fi echo echo -n "Checking free space on root filesystem... " STARTFREE=`df -h / |tail -n1|cut -c33-43` echo $STARTFREE echo "Entering /usr..." cd /usr echo -n " /usr/man: online manual pages -- " du -h man|tail -n1|cut -f1 if [ -d man ]; then ask_yes " Should we gzip manual pages (don't worry, man _will_ understand)" if [ $OK ];then echo " /usr/man -- gzipping man pages" gzip man/man?/* else echo " OK, leaving them alone" fi else echo "Nothing to be done for /usr/man" fi echo echo -n " /usr/share: some collection of spare info -- " du -h share|tail -n1|cut -f1 echo " We can shrink it a bit by removing extra timezone/terminfo/locale files" ask_yes " So, let's do it" if [ $OK ]; then cd /usr/share echo " /usr/share/zoneinfo: time zones all around the world! But if you live in" echo -n " $TIMEZONE, $TIMEREGION, you can do without rest which takes " du -h zoneinfo|tail -n1|cut -f1 ask_yes " Remove extra timezone info" if [ $OK ]; then cd zoneinfo for i in *; do if [ -d $i ]; then # this is a directory echo -n " >$i... " cd $i if [ $i = $TIMEREGION ]; then # ...e.g. "Europe" echo -n " aha!.. " for j in *; do if [ $j != $TIMEZONE ]; then rm -f $j fi done cd .. echo "cleaned up." else rm -f * cd .. rmdir $i echo "bye." fi else # then maybe a file?.. rm -f $i fi done cd .. echo -n " So, now it wants " du -h zoneinfo|tail -n1|cut -f1 # We've just cleaned it up... else echo "Yes sir." fi else echo "Nothing to be done for /usr/share" fi if [ -f $EASYCYRILLIC.tgz ]; then echo echo "Let's install Easy Cyrillic! It's COOL, COOL, COOL!" echo "Since it allows us to use cp866, koi8, and (under tortures) cp1251" echo "and uses various swicher-keys" ask_yes "So, OK to install" if [ $OK ]; then echo "Installing, installing, installing!" tar zxf $EASYCYRILLIC.tgz $EASYCYRILLIC/Install.me else echo "You'll be back. EC is nice." fi else echo "-----------------------------------------------------------" echo "There should be $EASYCYRILLIC.tgz here, but I can't see it." echo "I was relying a bit on it! (because it's worthy)." echo "I recommend you to get & set it up ASAP!" echo "-----------------------------------------------------------" fi
next prev parent reply other threads:[~2009-08-06 21:23 UTC|newest] Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top 2009-08-06 9:43 [Comm] Доработка после установки (was: Что есть beagled?) Dmitry Chistikov 2009-08-06 9:44 ` Aleksander Gorohovski 2009-08-06 11:42 ` Arcady Ivanov 2009-08-06 11:58 ` [Comm] Доработка после установки Владимир Гусев 2009-08-06 12:58 ` [Comm] Доработка после установки (was: Что есть beagled?) Dmitry Chistikov 2009-08-06 20:13 ` [Comm] Доработка после установки Arcady Ivanov 2009-08-06 21:23 ` Michael Shigorin [this message] 2009-08-07 5:54 ` Arcady Ivanov 2009-08-07 6:04 ` Michael A. Kangin 2009-08-07 6:20 ` Arcady Ivanov 2009-08-07 5:48 ` Dmitry Chistikov 2009-08-07 5:59 ` Arcady Ivanov 2009-08-07 7:40 ` Dmitry Chistikov 2009-08-07 7:46 ` Arcady Ivanov
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20090806212316.GC6046@osdn.org.ua \ --to=mike@osdn.org.ua \ --cc=community@lists.altlinux.org \ --cc=shigorin@gmail.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
ALT Linux Community general discussions This inbox may be cloned and mirrored by anyone: git clone --mirror http://lore.altlinux.org/community/0 community/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 community community/ http://lore.altlinux.org/community \ mandrake-russian@linuxteam.iplabs.ru community@lists.altlinux.org community@lists.altlinux.ru community@lists.altlinux.com public-inbox-index community Example config snippet for mirrors. Newsgroup available over NNTP: nntp://lore.altlinux.org/org.altlinux.lists.community AGPL code for this site: git clone https://public-inbox.org/public-inbox.git