Cygwin Install

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 4

#----------------------------------------------------------------------------------

------------
# Installation of Cygwin.
# V1.1 10/12/2007 Martin Aldrin
#----------------------------------------------------------------------------------
------------
use File::Copy;
use Term::ANSIColor qw(:constants);
use Time::local;
#use strict;

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 ="admin";
$signum = "admin"; 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\n
C:
chdir C:\\cygwin\\bin\n
set USER=$signum
set HOME=/home/$signum
set SHELL=/bin/bash
rxvt -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:/r
oot/bin:\$PATH\"\n
for i in /etc/profile.d/*.sh ; do
if \[ -f \$i \]; then
. \$i
fi
done
\nexport USER=$signum
export HOME=/home/$signum
export SHELL=/bin/bash
mkdir -p \$HOME\ncd \$HOME
source \$HOME/.bashrc";

#BASHRC
$bashrc='unset PROMPT_COMMAND
export PS1="\\[\\033[1m\\][\\w]\\\\$\\[\\033[0m\\] "
alias ls="ls -FX"
set -o notify
set -o ignoreeof
shopt -s cdspell
shopt -s cdable_vars
shopt -s checkhash
shopt -s checkwinsize
shopt -s sourcepath
shopt -s histappend
';
$bashrc="$bashrc
export PATH=\$PATH:/home/$signum/moshell
";
#INPUTRC
$inputrc = "set bell-style visible
set convert-meta Off
set output-meta On
set input-meta On
set completion-ignore-case on
set completion-query-items 150
set mark-directories on
set visible-stats On
set show-all-if-ambiguous On
set 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: Black
Rxvt*foreground: White
Rxvt*saveLines: 65535
Rxvt*termName: xterm
Rxvt*geometry: 144x64+0+0
Rxvt*loginShell: true
Rxvt*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=$signum
set HOME=/home/$signum
set SHELL=/bin/bash`;
system($startcygwin2); #Start Cygwin.
#BASHRC
if(-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"));
#INPUTRC
if(-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"));

#XDEFAULTS
if(-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";

close(NEWFILE);
}
sub Checkfile(){
my ($file) = @_;
#print "$file\n";
if(-e "$file"){

}
else{
return "$file\n";
}
}

ENDFILE:
exit;

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy