-
Notifications
You must be signed in to change notification settings - Fork 40
Change done to the container after a restore and perforce migration #12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
M3dinar
wants to merge
17
commits into
sourcegraph:main
Choose a base branch
from
M3dinar:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
9cbf0d4
Updated Ubuntu base image to 24.04 (noble)
M3dinar 9a16526
Merge pull request #1 from M3dinar/feature/ubuntu-update
M3dinar 2dc7d67
Removed NAME env variable
M3dinar 3f8bc6b
Merge pull request #2 from M3dinar/fix/folder-name
M3dinar 6a1f677
Setup is called at start or after restoring a checkpoint (all the time)
M3dinar 2ec8b21
Merge pull request #3 from M3dinar/feat/unify-setup-process
M3dinar bd57ea6
Refacto restore from checkpoint
M3dinar f0287a9
Merge pull request #4 from M3dinar/feature/restore-from-checkpoint
M3dinar ac24ca6
Added information about env variable JNL_PREFIX
M3dinar 9ae3ac8
Changed helix-p4d with the latest available
M3dinar 548aab7
Fixed remaining issue in the build due after removed files in previou…
M3dinar 4757b46
Removed trigger (not working)
M3dinar 79adbf9
Added prefix to logs
M3dinar 8c5f524
Added fresh install if no p4dctl services was found
M3dinar 3017b92
Removed configuration setting during restore process
M3dinar 3d460ff
Updated README.md to inform the default server configuration set by t…
M3dinar a460b9e
Show triggers when the server is configured
M3dinar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
This file was deleted.
Oops, something went wrong.
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,19 +1,82 @@ | ||
| #!/bin/bash | ||
|
|
||
| if [ ! -d "$P4ROOT/etc" ]; then | ||
| echo >&2 "First time installation, copying configuration from /etc/perforce to $P4ROOT/etc and relinking" | ||
| mkdir -p "$P4ROOT/etc" | ||
| cp -r /etc/perforce/* "$P4ROOT/etc/" | ||
| opts=() | ||
|
|
||
| # Check P4CHARSET environment variable | ||
| if [ -z "${P4CHARSET:-}" ]; then | ||
| echo "[ERROR] P4CHARSET environment variable is not set." | ||
| exit 255 | ||
| fi | ||
| if [ "${P4CHARSET:-}" != "none" ] && [ "${P4CHARSET:-}" != "utf8" ]; then | ||
| echo "[ERROR] P4CHARSET value unknown, expected 'none' or 'utf8'." | ||
| exit 255 | ||
| fi | ||
|
|
||
| mv /etc/perforce /etc/perforce.orig | ||
| ln -s "$P4ROOT/etc" /etc/perforce | ||
| # If P4CHARSET is set to "none", do not pass --unicode. Otherwise include it. | ||
| if [ "${P4CHARSET:-}" != "none" ]; then | ||
| opts+=(--unicode) | ||
| fi | ||
|
|
||
| if ! p4dctl list 2>/dev/null | grep -q "$NAME"; then | ||
| /opt/perforce/sbin/configure-helix-p4d.sh "$NAME" -n -p "$P4PORT" -r "$P4ROOT" -u "$P4USER" -P "${P4PASSWD}" --case "$P4CASE" --unicode | ||
| ## Check P4CASE environment variable | ||
| if [ -z "${P4CASE:-}" ]; then | ||
| echo "[ERROR] P4CASE environment variable is not set." | ||
| exit 255 | ||
| fi | ||
| if [ "${P4CASE:-}" != "-C0" ] && [ "${P4CASE:-}" != "-C1" ]; then | ||
| echo "[ERROR] P4CASE must be set to -C0 (Unix-style) or -C1 (Windows-style)." | ||
| exit 255 | ||
| fi | ||
| if [ "${P4CASE:-}" == "-C1" ]; then | ||
| opts+=(--case=1) | ||
| else | ||
| opts+=(--case=0) | ||
| fi | ||
|
|
||
| # Script to configure the server with the given param so a p4dctl is created. | ||
| # Helper of the script available in it | ||
| #------------------------------------------------------------------------------- | ||
| # Configuration script for P4 Server | ||
| # Copyright 2025, Perforce Software Inc. All rights reserved. | ||
| # | ||
| # Synopsis: | ||
| # | ||
| # configure-p4d.sh [service-name] [options] | ||
| # | ||
| # Where options are: | ||
| # | ||
| # -n - Use the following flags in non-interactive mode | ||
| # -p <P4PORT> - Set P4 Server's address | ||
| # -r <P4ROOT> - Set P4 Server's root directory | ||
| # -u <username> - P4 super-user login name | ||
| # -P <password> - P4 super-user password | ||
| # --unicode - Enable unicode mode on server | ||
| # --case - Case-sensitivity (0=sensitive[default],1=insensitive) | ||
| # | ||
| # Password is only needed on initial configuration when the super-user | ||
| # account is created. If reconfiguring an existing Perforce Server, the | ||
| # super-user name and password are left alone. | ||
| # | ||
| # Unicode mode is disabled by default. Specify --unicode if you | ||
| # want it. This will change in a future release. | ||
| # | ||
| #------------------------------------------------------------------------------- | ||
| /opt/perforce/sbin/configure-helix-p4d.sh "$P4NAME" -n -p "$P4PORT" -r "$P4HOME" -u "$P4USER" -P "${P4PASSWD}" "${opts[@]}" | ||
|
|
||
| # Server configuration is set to default security 4, so we need to get a ticket with p4 login to change configuration settings. | ||
| p4 login <<EOF | ||
| $P4PASSWD | ||
| EOF | ||
|
|
||
| echo "[INFO] Configuring server settings..." | ||
| p4 configure set $P4NAME#security=2 | ||
| p4 configure set $P4NAME#server.depot.root=$P4DEPOTS | ||
| p4 configure set $P4NAME#journalPrefix=$P4CKP/$JNL_PREFIX | ||
|
|
||
| p4dctl start -t p4d "$NAME" | ||
| # In the case where we restore a checkpoint, we must ensure that triggers are removed | ||
| echo "[INFO] Existing triggers :" | ||
| p4 triggers -o | ||
| echo "[INFO] Removing triggers ..." | ||
| echo "Triggers:" | p4 triggers -i | ||
|
|
||
| # Stopping the server so the new configuration is taken into account | ||
| p4dctl stop -t p4d "$P4NAME" |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To remove