Skip to content

Instantly share code, notes, and snippets.

@iinfin
Last active January 12, 2022 14:26
Show Gist options
  • Save iinfin/6d496ef7ebc32950f21c14c6e7af1de5 to your computer and use it in GitHub Desktop.
Save iinfin/6d496ef7ebc32950f21c14c6e7af1de5 to your computer and use it in GitHub Desktop.
perforce helix server on macos
#!/bin/sh
CURRENT_DIR=$(pwd)
DOWNLOAD_URL="https://www.perforce.com/downloads/perforce/r21.2/bin.macosx1015x86_64/helix-core-server.tgz"
DOWNLOAD_DIR="${CURRENT_DIR}/tmp_perforce_download/"
sudo rm -rf "${DOWNLOAD_DIR}"
sudo mkdir "${DOWNLOAD_DIR}"
sudo wget "${DOWNLOAD_URL}"
sudo tar -xzf helix-core-server.tgz
# make files executable
chmod +x p4
chmod +x p4d
: '#################################################################################################
COPY EXECUTABLES TO A DEDICATED DIRECTORY'
USER_ID=$(id -u)
PERFORCE_BIN=//Applications/P4D
sudo rm -rf "${PERFORCE_BIN}/"
sudo mkdir "${PERFORCE_BIN}/"
# copy executables to perforce bin
sudo cp p4 "${PERFORCE_BIN}/p4"
sudo cp p4d "${PERFORCE_BIN}/p4d"
: '#################################################################################################
SETUP LAUNCH DAEMON'
# copy launch daemon plist
sudo cp com.perforce.plist /Library/LaunchDaemons/
# set permissions
sudo chown root:wheel /Library/LaunchDaemons/com.perforce.plist
sudo chmod $USER_ID /Library/LaunchDaemons/com.perforce.plist
# start daemon
sudo launchctl load /Library/LaunchDaemons/com.perforce.plist
: '#################################################################################################
SET PERMISSIONS'
# remember to set p4d process full disk access in settings
# set permissions for required directories
sudo chmod -R 777 /private/tmp
sudo chmod 777 /private/tmp/
sudo chmod 777 /private/tmp/*
sudo chmod -R 777 /Volumes/Public
sudo chmod 777 /Volumes/Public/
sudo chmod 777 /Volumes/Public/*
sudo chmod -R 777 /Volumes/Public/_perforce
sudo chmod 777 /Volumes/Public/_perforce/
sudo chmod 777 /Volumes/Public/_perforce/*
: '#################################################################################################
MOVE DEPOT FILES TO A DEDICATED DIRECTORY'
# https://community.perforce.com/s/article/2559
p4 -ztag depot -o depot
# protect while in migration
p4 protect
: '
list user * * -//...
list group * * -//...
super user <username> * //...
'
# list all existing depots
p4 -ztag depots
# update the map field of each depot specification:
# p4 depot <depot_name>
# Map: depot1/...
# Map: E:\Users\perforce\depot1\...
# p4 verify -q //<depot_name >/...
# edit or remove previous protections
p4 protect
: '#################################################################################################
SETUP USERS ON OTHER WORKSTATIONS WITH P4V'
# https://www.perforce.com/perforce/doc.current/manuals/p4guide/Content/P4Guide/chapter.basic-tasks.html
# https://www.perforce.com/perforce/doc.current/manuals/p4guide/Content/P4Guide/chapter.configuration.html
# https://www.youtube.com/playlist?list=PLxdnSsBqCrrGq_8ecmdE7A6KnRfbhHE4Q
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Debug</key>
<false/>
<key>Label</key>
<string>com.perforce</string>
<key>OnDemand</key>
<false/>
<key>ProgramArguments</key>
<array>
<string>//Applications/P4D/p4d</string>
</array>
<key>EnvironmentVariables</key>
<dict>
<key>P4LOG</key>
<string>//Applications/P4D/p4log.log</string>
<key>P4PORT</key>
<string>1666</string>
<key>P4ROOT</key>
<string>//Applications/P4D/</string>
<key>P4NAME</key>
<string>perforce</string>
<key>P4DESCRIPTION</key>
<string>Perforce Server (P4D)</string>
</dict>
<key>RunAtLoad</key>
<true/>
<key>ServiceDescription</key>
<string>Launches Perforce Server</string>
<key>StartInterval</key>
<integer>180</integer>
<key>KeepAlive</key>
<true/>
</dict>
</plist>
# Perforce File Type Mapping Specifications.
# TypeMap: a list of filetype mappings; one per line.
# Each line has two elements:
# Filetype: The filetype to use on 'p4 add'.
# Path: File pattern which will use this filetype.
# See 'p4 help typemap' for more information.
# https://www.perforce.com/manuals/p4sag/Content/P4SAG/defining-filetype-with-p4-typemap.html
# https://www.perforce.com/manuals/cmdref/Content/CmdRef/file.types.synopsis.modifiers.html
# Unreal Engine overrides
# https://docs.unrealengine.com/en-US/ProductionPipelines/SourceControl/Perforce/index.html
# Using compressed text versioning (`text+C` instead of `text`) to prevent `Operation 'rename' failed` error:
# https://community.perforce.com/s/article/3191
TypeMap:
binary //....bmp
binary //....doc
binary //....dot
binary+F //....gz
binary+F //....avi
binary+w //....exp
text+C //....asp
text+C //....cnf
text+C //....css
text+C //....htm
text+C //....html
text+C //....inc
text+C //....js
text+C //....log
text+C //....pdm
text+C //....txt
binary+F //....gif
binary+F //....ico
binary+F //....jpg
binary+F //....png
binary+F //....mpg
binary //....pdf
binary //....ppt
binary //....xls
binary+w //....exe
binary+w //....dll
binary+w //....lib
binary+w //....app
binary+w //....dylib
binary+w //....stub
binary+w //....ipa
text+C //....ini
text+C //....config
text+C //....cpp
text+C //....h
text+C //....c
text+C //....cs
text+C //....m
text+C //....mm
text+C //....py
binary+l //....uasset
binary+l //....umap
binary+l //....upk
binary+l //....udk
binary+l //....ubulk
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment