Last active
May 19, 2017 20:30
-
-
Save matthewtckr/7340e235371a5f870c095d279299cd17 to your computer and use it in GitHub Desktop.
Pentaho Server Comparison
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
find $(pwd) -type f \( -name "*.xml" -or -name "*.properties" -or -name "*.sh" -or -name "*.cfg" \) -print0 | xargs -0 tar -czf $(basename $PWD)_config.tar.gz | |
find $(pwd) -type f -print0 | xargs -0 stat -f '%N%t%Su:%Sg%t%Lp%n' | while read LINE | |
do | |
FILE=$(echo $LINE | awk '{print $1}') | |
OWNER=$(echo $LINE | awk '{print $2}') | |
FILEPERM=$(echo $LINE | awk '{print $3}') | |
MD5SUM=$(md5 $FILE | awk '{print $NF}') | |
echo -e "$FILE\t$MD5SUM\t$OWNER\t$FILEPERM" | |
done | gzip > $(basename $PWD)_filesystem.txt.gz | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$BaseDirectory = "DIRECTORY-PATH-HERE" | |
$OutputFile = "config.zip" | |
## DO NOT EDIT BELOW THIS LINE | |
Set-Location $BaseDirectory | |
[Environment]::CurrentDirectory = $pwd | |
$Md5File = [IO.Path]::GetFullPath( ".\md5.txt") | |
$OutputFile = [IO.Path]::GetFullPath(".\$OutputFile") | |
if ( Test-Path $OutputFile ) { | |
del $OutputFile | |
} | |
if ( Test-Path $Md5File ) { | |
del $Md5File | |
} | |
$md5 = New-Object -TypeName System.Security.Cryptography.MD5CryptoServiceProvider | |
$Content = @() | |
Get-ChildItem -Recurse | ? { $_.getType().Name -eq "FileInfo" } | ? { $_.FullName -ne $ConfigFiles } | % { | |
$file = $_ | |
$hash = [System.BitConverter]::ToString($md5.ComputeHash([System.IO.File]::ReadAllBytes($file.FullName))) -replace '-', '' | |
$Content += [Array] "$($file.FullName)`t$($hash.ToLower())" | |
} | |
$Content | Out-File $Md5File | |
$FileList = $(Get-ChildItem -Recurse | ? { $_.getType().Name -eq "FileInfo" } | ? { ".xml", ".properties", ".bat", ".cfg" -contains $_.Extension -or $_.Name -eq "md5.txt" }) | |
$FileList | Write-Zip -EntryPathRoot . -OutputPath $OutputFile | Out-Null | |
del $Md5File | |
Write-Host "Please attach `"$(Resolve-Path $OutputFile)`" to case" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
find -type f \( -name "*.xml" -or -name "*.properties" -or -name "*.sh" -or -name "*.cfg" \) -exec zip "$(basename $PWD)_config.zip" {} + | |
find -type f -printf '%p\t%u:%g\t%m\n' | sort | while read LINE | |
do | |
FILE=$(echo "$LINE" | awk -F\\t '{print $1}') | |
OWNER=$(echo "$LINE" | awk -F\\t '{print $2}') | |
FILEPERM=$(echo "$LINE" | awk -F\\t '{print $3}') | |
MD5SUM=$(md5sum "$FILE" | awk '{print $1}') | |
echo -e "$FILE\t$MD5SUM\t$OWNER\t$FILEPERM" | |
done | gzip > "$(basename $PWD)_filesystem.txt.gz" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment