es

download es

If you can't read please download the document

description

ewas

Transcript of es

my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);$year+=1900;$cygwinpath = "c:/cygwin";$startcygwin1 = "$cygwinpath/bin/bash.exe -c \"echo opening and closing cygwin...done.\"";$startcygwin2 = "$cygwinpath/bin/rxvt.exe -sl 65000 -e /bin/bash --login -i \"echo opening and closing cygwin...done.\"";#$signum = $ENV{'USERNAME'};$signum = `$cygwinpath/bin/whoami`; chomp($signum);$permissions = "$cygwinpath/bin/chmod 755 $cygwinpath/cygwin.bat";$installbackup = "installbackup";$date_time = "$year-$mon-$mday\_$hour.$min";$mkdir = "$cygwinpath/bin/mkdir.exe -p $cygwinpath/tmp/$installbackup/$date_time"; #CYGWIN.BAT$cygwinbat ="\@echo off\nC:chdir C:\\cygwin\\bin\nset USER=$signumset HOME=/home/$signumset SHELL=/bin/bashrxvt -sl 65000 -e /bin/bash --login -i";#PROFILE$profile = "export PATH=\"/usr/bin:/bin:/usr/local/bin:/sbin:/usr/sbin:/usr/bin/X11:/usr/local/sbin:/root/bin:\$PATH\"\nfor i in /etc/profile.d/*.sh ; do if \[ -f \$i \]; then . \$i fidone\nexport USER=$signumexport HOME=/home/$signumexport SHELL=/bin/bashmkdir -p \$HOME\ncd \$HOMEsource \$HOME/.bashrc";#BASHRC$bashrc='unset PROMPT_COMMANDexport PS1="\\[\\033[1m\\][\\w]\\\\$\\[\\033[0m\\] "alias ls="ls -FX"set -o notifyset -o ignoreeofshopt -s cdspellshopt -s cdable_varsshopt -s checkhashshopt -s checkwinsizeshopt -s sourcepathshopt -s histappend';$bashrc="$bashrcexport PATH=\$PATH:/home/$signum/moshell";#INPUTRC$inputrc = "set bell-style visibleset convert-meta Offset output-meta Onset input-meta Onset completion-ignore-case onset completion-query-items 150set mark-directories onset visible-stats Onset show-all-if-ambiguous Onset expand-tilde On\"\\e\[D\": backward-char\"\\e\[C\": forward-char\"\\e\[A\": history-search-backward\"\\e\[B\": history-search-forward\"\\e\[7~\": beginning-of-line\"\\e\[8~\": end-of-line\"\\e\[1~\": beginning-of-line\"\\e\[4~\": end-of-line\"\\e\[3~\": delete-char\"\\e\[2~\": menu-complete\"\\M-\[2~\": paste-from-clipboard # Insert\"\\M-q\": menu-complete\"\\C-d\": delete-char\"\\C-l\": clear-screen\"\\C-xdf\": dump-functions\"\\C-xdv\": dump-variables\"\\C-xdm\": dump-macros";#Xdefaults$xdefaults = "Rxvt*background: BlackRxvt*foreground: WhiteRxvt*saveLines: 65535Rxvt*termName: xtermRxvt*geometry: 144x64+0+0Rxvt*loginShell: trueRxvt*font: \"Lucida Console-11\"Rxvt*cutchars: `\"'&()*,;? []{|}";if(-e "$cygwinpath/bin/rxvt.exe"){if(-e "$cygwinpath/bin/unzip.exe"){}}else{print RED "File $cygwinpath/bin/rxvt.exe or $cygwinpath/bin/unzip.exe is missing,\nreinstall cygwin.\n"; print WHITE"";goto ENDFILE;}@check;system($mkdir);system($startcygwin1); #Start Cygwin.#CYGWINBAT$movecygwinbat = "$cygwinpath/bin/mv.exe $cygwinpath/cygwin.bat $cygwinpath/tmp/$installbackup/$date_time/cygwin.bat";OpenFile("cygwin.bat","$movecygwinbat","$cygwinbat","tmp");system($permissions); #Change permissions.push(@check, Checkfile("$cygwinpath/cygwin.bat"));#PROFILE$moveprofile = "$cygwinpath/bin/mv.exe $cygwinpath/etc/profile $cygwinpath/tmp/$installbackup/$date_time/profile";OpenFile("/etc/profile","$moveprofile","$profile");push(@check, Checkfile("$cygwinpath/etc/profile"));`set USER=$signumset HOME=/home/$signumset SHELL=/bin/bash`;system($startcygwin2); #Start Cygwin.#BASHRCif(-e "$cygwinpath/home/$signum/.bashrc"){$movebashrc = "$cygwinpath/bin/mv.exe $cygwinpath/home/$signum/.bashrc $cygwinpath/tmp/$installbackup/$date_time/.bashrc";}OpenFile("/home/$signum/.bashrc","$movebashrc","$bashrc");push(@check, Checkfile("$cygwinpath/home/$signum/.bashrc"));#INPUTRCif(-e "$cygwinpath/home/$signum/.inputrc"){$moveinputrc = "$cygwinpath/bin/mv.exe $cygwinpath/home/$signum/.inputrc $cygwinpath/tmp/$installbackup/$date_time/.inputrc";}OpenFile("/home/$signum/.inputrc","$moveinputrc","$inputrc");push(@check, Checkfile("$cygwinpath/home/$signum/.inputrc"));#XDEFAULTSif(-e "$cygwinpath/home/$signum/.Xdefaults"){$movexdefaults = "$cygwinpath/bin/mv.exe $cygwinpath/home/$signum/.Xdefaults $cygwinpath/tmp/$installbackup/$date_time/.Xdefaults";}OpenFile("/home/$signum/.Xdefaults","$movexdefaults","$xdefaults");push(@check, Checkfile("$cygwinpath/home/$signum/.Xdefaults"));if(@check != null){print RED"FAILED, FILES IS MISSING\n";print @check; print WHITE"";goto ENDFILE;}else{print GREEN"Patching of files seems to be ok!\n"; print WHITE"";}sub OpenFile(){my ($file,$move,$var) =@_;system($move);open(NEWFILE, ">$cygwinpath/$file");print NEWFILE "$var";