Download PDF

As I write a lot of scripts for different tasks I find it useful to keep a hold of them all for future reference.
One of the easiest ways of keeping this information no matter where I am is to create my own home subversion repository. This means that no matter where I am, as long as I have http access to my home server I can get to my files.

How do you do this, well the first thing is to create your repository. Suppose I want to create a Repository at /usr/local/subversion/repository using fsfs database so execute the command:

mkdir -v /usr/local/subversion/
/usr/bin/svnadmin create --fs-type fsfs /usr/local/subversion/repository

That should create a subversion repository under /usr/local/subversion/repository.

ls /usr/local/subversion/repository
conf/ dav/ db/ format hooks/ locks/ README.txt

You should be able to see those files under the repository directory.

Setting up httpd.conf to serve the created repository:

Add the following lines to httpd.conf or the appropriate apache configuration file.

<Location /subversion>

  DAV svn

  SVNPath /usr/local/subversion/repository/

</Location>

Make sure that the module mod_dav is loaded in the apache configuration file and is also present under modules directory.

 

Setting up authentication:

For the authentication we need to make changes to the apache configuration yet another time.

Basic authentication requires that we just add the following lines to the httpd.conf where we added the svn repository earlier.

AuthType Basic

AuthName "{Name of the authentication popup tab}"

AuthUserFile {Location of the password file}

Require valid-user

So it should look like this.

<Location /subversion>

  DAV svn

  SVNPath /usr/local/subversion/repository/

  AuthType Basic

  AuthName "Subversion repository"

  AuthUserFile /usr/local/subversion/repository/conf/svn-auth-file

  Require valid-user

</Location>

It is necessary that we add users to the password file before anyone can access it, which is described in the next step.

 

Adding SVN users:

Since we are using svn with an apache server, and an apache basic authentication method.

We need to create a password file with the htpasswd binary provided with a standard apache installation.

htpasswd -cmd /usr/local/subversion/repository/conf/svn-auth-file {user-name}

-c option creates a new htpasswd file.

-m encrypts the password with an MD5 algorithm.

-d encrypts the password with a CRYPT algorithm.

Where {user-name} stands for an actual user name that will be used for authentication.

Warning: We should not use the -c option once we have added the first user. Using so will create and replace all existing user within the file.

htpasswd -md /usr/local/subversion/repository/conf/svn-auth-file {user-name}

 

Setting up the initial repository layout:

A repository mostly contains 3 standard folders.

branches

tags

trunk

For creating those standard folders in a repository, create a temporary folder anywhere you want, /tmp would be a good idea, with the following subdirectories.

mkdir -pv /tmp/subversion-layout/{branches,tags}

After we have made all the layout folders, move all the contents of your project to the trunk folder.

mv -v /usr/local/apache2/htdocs /tmp/subversion-layout/trunk

Then make an initial import of the temporary created directory.

/usr/local/subversion/bin/svn import /tmp/subversion-layout/ http://127.0.0.1/subversion/

This will setup you up with a default repository layout, and make a first revision.

Download PDF

Windows PE ( Preboot Environment ) is a cut down operating system that allows you to install 32-bit and 64-bit versions of Windows on new hardware. This was first introduced with Windows Vista and is now part of Windows 7.

To create a Windows PE environment you need to download the Windows AIK and install it.
Once installed you should see a “Microsoft Windows AIK” group in your programs. Open the “Deployment Tools Command Prompt” ( Note : If you are running this on Windows 7 press your right mouse button and run it as an administrator )
Creating a Dual Boot Image ( 32-bit and 64-bit )
In order to dual boot we need to have the main boot image for both 32-bit and 64-bit systems. To create the 64-bit boot image do the following:
mkdir c:\Temp
call copype.cmd AMD64 c:\Temp\Boot64
copy winpe.wim c:\Temp\winpe_x64.wim

Now close the window and open a new “Deployment Tools Command Prompt”.
This time we will get the 32-bit boot image and the other files needed. To do this use the following commands :
call copype.cmd x86 C:\Temp\Boot
del /Q etfsboot.com
move ISO\boot\boot.sdi boot.sdi
rmdir /S /Q ISO
imagex /mount winpe.wim 1 mount
copy mount\Windows\Boot\PXE\pxeboot.n12 pxeboot.n12
copy mount\Windows\Boot\PXE\bootmgr.exe bootmgr.exe
copy mount\Windows\System32\bcdedit.exe bcdedit.exe
imagex /unmount mount
rmdir /Q mount
ren winpe.wim winpe_x86.wim
copy c:\Temp\winpe_x64.wim ./
What this does is to create a 32-bit image, pulls the network boot files and boot editor from that image and finally copies the 64-bit boot file into the same directory.
The next bit that is needed is to create the BCD file. This has been simplified by using the following batch file. This will give you the option to choose either 32-bit or 64-bit PE environment.

echo *** Creating WinPE BCD (boot configuration data) File
set BCDFILE=BCD
Bcdedit -createstore “%BCDFILE%”
Bcdedit -store “%BCDFILE%” -create {ramdiskoptions} -d “Ramdisk options”
Bcdedit -store “%BCDFILE%” -set {ramdiskoptions} ramdisksdidevice boot
Bcdedit -store “%BCDFILE%” -set {ramdiskoptions} ramdisksdipath \Boot\boot.sdi
Bcdedit -store “%BCDFILE%” -deletevalue {ramdiskoptions} description

rem 32Bit
for /f “tokens=1-3” %%a in (‘Bcdedit -store “%BCDFILE%” -create -d “Windows PE 32-Bit” -application osloader’) do set guid1=%%c
Bcdedit -store “%BCDFILE%” -set %guid1% systemroot \Windows
Bcdedit -store “%BCDFILE%” -set %guid1% detecthal Yes
Bcdedit -store “%BCDFILE%” -set %guid1% winpe Yes
Bcdedit -store “%BCDFILE%” -set %guid1% description “Windows PE 32-Bit”
Bcdedit -store “%BCDFILE%” -set %guid1% osdevice ramdisk=[boot]\Boot\winpe_x86.wim,{ramdiskoptions}
Bcdedit -store “%BCDFILE%” -set %guid1% device ramdisk=[boot]\Boot\winpe_x86.wim,{ramdiskoptions}

rem 64Bit
for /f “tokens=1-3” %%a in (‘Bcdedit -store “%BCDFILE%” -create -d “Windows PE 64-Bit” -application osloader’) do set guid2=%%c
Bcdedit -store “%BCDFILE%” -set %guid2% systemroot \Windows
Bcdedit -store “%BCDFILE%” -set %guid2% detecthal Yes
Bcdedit -store “%BCDFILE%” -set %guid2% winpe Yes
Bcdedit -store “%BCDFILE%” -set %guid2% description “Windows PE 64-Bit”
Bcdedit -store “%BCDFILE%” -set %guid2% loadoptions ramdisk=[boot]\Boot\winpe_x64.wim,\”DISABLE_INTEGRITY_CHECKS”
Bcdedit -store “%BCDFILE%” -set %guid2% osdevice ramdisk=[boot]\Boot\winpe_x64.wim,{ramdiskoptions}
Bcdedit -store “%BCDFILE%” -set %guid2% device ramdisk=[boot]\Boot\winpe_x64.wim,{ramdiskoptions}

rem Setup Bootmanager
Bcdedit -store “%BCDFILE%” -create {bootmgr} -d “Windows 7 BootManager”
Bcdedit -store “%BCDFILE%” -set {bootmgr} timeout 10
Bcdedit -store “%BCDFILE%” -set {bootmgr} displayorder %guid1% %guid2%
Bcdedit -store “%BCDFILE%” -enum all
This will create the boot file (BCD) and at the end show you the boot manager configuration.
You will then have the following files in your Boot directory
BCD BCD.LOG boot.sdi winpe_x64.wim
bcdedit.exe bootmgr.exe pxeboot.n12 winpe_x86.wim
You can safely delete the file bcdedit.exe as that is not longer needed.
All the other files need to be copied to your tftp server into a folder called “Boot” ( This is case sensitive ). So on a linux tftp server this will be located in /tftpboot/Boot.

Linux TFTP server configuration
As linux uses “/” and Windows uses “\” we need to configure the linux tftp server to substitute the slashes in order for it to work.
Firstly you need to edit the /etc/xinetd.d/tftp file to pass an argument to the server.
The existing line will probably be
server_args = -s /tftpboot
this needs to be changed to the following
server_args = -s /tftpboot -m /etc/tftpd.map –vv
Note : The “-vv” at the end is purely for debugging so you can trace what files are downloaded in the linux /var/log/messages file. You can remove this once you are happy everything is all working.
Next you need to create /etc/tftpd.map and put the following lines in it
# Convert backslashes to slashes
rg \\ /
Once you have created the file you need to restart the xinetd daemon typing the following command in as “su”
service xinetd restart
Your tftp server is now ready to use.
DHCP Boot line
On your DHCP server you need to tell it which server and what file the system needs to network boot. Usually for a linux network boot you will have the following two lines in the dhcp description
next-server 143.234.96.47;
filename “pxelinux.0”;
the first line tells the system which server it needs to network boot from , the second line tells it what it needs to boot.
In order to boot the Windows PE environment you need to set the filename to boot as this
filename “\\Boot\\pxeboot.n12”;
This basically tells the system to boot the file from the \Boot folder of your tftp server.

« Previous posts Next posts » Back to top