Created
September 18, 2021 11:10
-
-
Save dln/7c0a8a87f0a06332a202b8b7ff93fa12 to your computer and use it in GitHub Desktop.
Configures plasticscm client. Useful for CI jobs.
This file contains hidden or 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 | |
set -eo pipefail | |
function _ensure_var() { | |
if [ -z "${!1}" ]; then | |
echo "$1 must be set" | |
exit 1 | |
fi | |
} | |
_ensure_var PLASTIC_SERVER | |
_ensure_var PLASTIC_USERNAME | |
_ensure_var PLASTIC_PASSWORD | |
_ensure_var PLASTIC_ENCRYPTION_PASSWORD | |
clconfigureclient \ | |
--language=en \ | |
--workingmode=LDAPWorkingMode \ | |
--user=${PLASTIC_USERNAME} \ | |
--password=${PLASTIC_PASSWORD} \ | |
--server=${PLASTIC_SERVER} | |
CRYPT_PASSWORD=$(cm crypt "${PLASTIC_PASSWORD}" -NoNewWindow -Wait | cut -b17-) | |
cat >$HOME/.plastic4/client.conf <<EOF | |
<?xml version="1.0"?> | |
<ClientConfigData xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | |
<Language /> | |
<WorkspaceServer>${PLASTIC_SERVER}</WorkspaceServer> | |
<WorkingMode>LDAPWorkingMode</WorkingMode> | |
<SecurityConfig>::0:${PLASTIC_USERNAME}:${CRYPT_PASSWORD}:</SecurityConfig> | |
<MergeTools> | |
<MergeToolData> | |
<FileType>enTextFile</FileType> | |
<FileExtensions>*</FileExtensions> | |
<Tools> | |
<string>gtkmergetool -b="@basefile" -bn="@basesymbolic" -bh="@basehash" -s="@sourcefile" -sn="@sourcesymbolic" -sh="@sourcehash" -d="@destinationfile" -dh="@destinationhash" -a -r="@output" -t="@filetype" -i="@comparationmethod" -e="@fileencoding" -m="@mergetype" -re="@resultencoding" --progress="@progress" --extrainfofile="@extrainfofile"</string> | |
</Tools> | |
</MergeToolData> | |
</MergeTools> | |
<DiffTools> | |
<DiffToolData> | |
<FileType>enTextFile</FileType> | |
<FileExtensions>*</FileExtensions> | |
<Tools> | |
<string>gtkmergetool -s="@sourcefile" -sn="@sourcesymbolic" -d="@destinationfile" -dn="@destinationsymbolic" -t="@filetype" -i="@comparationmethod" -e="@fileencoding"</string> | |
</Tools> | |
</DiffToolData> | |
</DiffTools> | |
<ShowPerformanceWarnings>yes</ShowPerformanceWarnings> | |
<MergeWithPendingChanges>yes</MergeWithPendingChanges> | |
<StackTrace>no</StackTrace> | |
<SetFilesAsReadOnly>no</SetFilesAsReadOnly> | |
<SetRevisionFileDate>no</SetRevisionFileDate> | |
<SupportSmbWorkspaces>no</SupportSmbWorkspaces> | |
<PerformAddPlusCi>no</PerformAddPlusCi> | |
<CheckFileContentForChanged>yes</CheckFileContentForChanged> | |
<CaseSensitiveFsOnMac>no</CaseSensitiveFsOnMac> | |
<SameItemDifferentCaseError>no</SameItemDifferentCaseError> | |
<CheckinQueuesSize>50</CheckinQueuesSize> | |
<DownloadPoolSize>16</DownloadPoolSize> | |
<UploadCompressionSize>16</UploadCompressionSize> | |
<UploadReadPoolSize>16</UploadReadPoolSize> | |
<PendingChangesOnSwitchAction>None</PendingChangesOnSwitchAction> | |
<LastRunningEdition>cloud</LastRunningEdition> | |
<UseChangeTrackerService>YES</UseChangeTrackerService> | |
</ClientConfigData> | |
EOF | |
cat >$HOME/.plastic4/profiles.conf <<EOF | |
<?xml version="1.0"?> | |
<ServerProfileData xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | |
<Profiles> | |
<ServerProfile> | |
<Name>${PLASTIC_SERVER}</Name> | |
<Server>${PLASTIC_SERVER}</Server> | |
<WorkingMode>LDAPWorkingMode</WorkingMode> | |
<SecurityConfig>::0:${PLASTIC_USERNAME}:${CRYPT_PASSWORD}:</SecurityConfig> | |
</ServerProfile> | |
</Profiles> | |
</ServerProfileData> | |
EOF | |
CRYPT_ENCRYPTION_PASSWORD=$(cm crypt "${PLASTIC_ENCRYPTION_PASSWORD}" -NoNewWindow -Wait | cut -b17-) | |
cat >$HOME/.plastic4/server.key <<EOF | |
AES128 |SoC|${CRYPT_ENCRYPTION_PASSWORD} | |
EOF | |
cat >$HOME/.plastic4/cryptedservers.conf <<EOF | |
${PLASTIC_SERVER} server.key | |
EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment