From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on sa.int.altlinux.org X-Spam-Level: X-Spam-Status: No, score=-1.8 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.5 Date: Fri, 7 Aug 2009 00:23:16 +0300 From: Michael Shigorin To: ALT Linux Community general discussions Message-ID: <20090806212316.GC6046@osdn.org.ua> Mail-Followup-To: ALT Linux Community general discussions References: <2876aabc0908060243w404cd001wecb480fdb9d2f34f@mail.gmail.com> <4A7AC18D.7040406@ikir.ru> <2876aabc0908060558l4084355dx1f551d2e5614790b@mail.gmail.com> <4A7B3957.2070704@ikir.ru> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="3V7upXqbjpZ4EhLz" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <4A7B3957.2070704@ikir.ru> User-Agent: Mutt/1.4.2.1i Subject: Re: [Comm] =?koi8-r?b?5M/SwcLP1MvBINDP08zFINXT1MHOz9fLyQ==?= X-BeenThere: community@lists.altlinux.org X-Mailman-Version: 2.1.12 Precedence: list Reply-To: shigorin@gmail.com, ALT Linux Community general discussions List-Id: ALT Linux Community general discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Aug 2009 21:23:32 -0000 Archived-At: List-Archive: List-Post: --3V7upXqbjpZ4EhLz Content-Type: text/plain; charset=koi8-r Content-Disposition: inline Content-Transfer-Encoding: 8bit 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 --3V7upXqbjpZ4EhLz Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="rh5.1clean" #!/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 --3V7upXqbjpZ4EhLz--