Created
September 21, 2022 05:52
-
-
Save christian-oudard/3c26d90651b7eb142008267d289e966a to your computer and use it in GitHub Desktop.
Automate running pCloud from the command line with 1password and expect
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
#! /usr/bin/bash | |
# Account information. | |
OP_EMAIL=<email> | |
OP_MOUNTPOINT=/home/<username>/pCloudDrive | |
OP_USER_ID=<user-id> # Gotten from `op account list`. | |
# Stop server. | |
if [[ $1 == 'stop' ]]; then | |
expect -f - >/dev/null <<END_EXPECT | |
spawn pcloudcc --commands_only | |
expect "pCloud console client v.2.0.1\r | |
Supported commands are:\r | |
startcrypto <crypto pass>, stopcrypto, finalize, q, quit\r | |
> " | |
send -- "finalize\r" | |
expect eof | |
END_EXPECT | |
exit 0 | |
fi | |
# Get passwords. | |
op whoami >/dev/null 2>&1 | |
if [[ $? == 1 ]]; then | |
eval $(op signin --account $OP_USER_ID) | |
export "OP_SESSION_$OP_USER_ID" | |
fi | |
PASSWORD=$(op item get pcloud --fields label="password") | |
CRYPTO_PASS=$(op item get pcloud --fields label="crypto pass") | |
# Start server. | |
expect -f - >/dev/null <<END_EXPECT | |
spawn pcloudcc --daemonize --username=$OP_EMAIL --mountpoint $OP_MOUNTPOINT --password --crypto | |
expect "pCloud console client v.2.0.1\r | |
Please, enter password\r | |
" | |
send -- "$PASSWORD\r" | |
expect "Enter crypto password.\r | |
Please, enter password\r | |
" | |
send -- "$CRYPTO_PASS\r" | |
expect eof | |
END_EXPECT |
That's the 1password command line tool.
…-------- Original Message --------
On Apr 11, 2024, 12:38, rjcab wrote:
@rjcab commented on this gist.
---------------------------------------------------------------
Hello. I tried but I got the error:
***@***.***:~/pcloud# ./pcloudstartup.sh ./pcloudstartup.sh: line 29: op: command not found ./pcloudstartup.sh: line 30: op: command not found ***@***.***:~/pcloud#
Do I need to do something with:
PASSWORD=$(op item get pcloud --fields label="password")
CRYPTO_PASS=$(op item get pcloud --fields label="crypto pass")
thanks
—
Reply to this email directly, [view it on GitHub](https://gist.github.com/christian-oudard/3c26d90651b7eb142008267d289e966a#gistcomment-5020375) or [unsubscribe](https://github.com/notifications/unsubscribe-auth/AAA6M7DOMF6CG7B5AGGZHETY43KBZBFKMF2HI4TJMJ2XIZLTSKBKK5TBNR2WLJDUOJ2WLJDOMFWWLO3UNBZGKYLEL5YGC4TUNFRWS4DBNZ2F6YLDORUXM2LUPGBKK5TBNR2WLJDHNFZXJJDOMFWWLK3UNBZGKYLEL52HS4DFVRZXKYTKMVRXIX3UPFYGLK2HNFZXIQ3PNVWWK3TUUZ2G64DJMNZZDAVEOR4XAZNEM5UXG5FFOZQWY5LFVEYTCOBUG4ZDQMBZU52HE2LHM5SXFJTDOJSWC5DF).
You are receiving this email because you authored the thread.
Triage notifications on the go with GitHub Mobile for [iOS](https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675) or [Android](https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub).
but sorry what is 1password, a package to download ?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello. I tried but I got the error:
root@pve:~/pcloud# ./pcloudstartup.sh ./pcloudstartup.sh: line 29: op: command not found ./pcloudstartup.sh: line 30: op: command not found root@pve:~/pcloud#
Do I need to do something with:
PASSWORD=$(op item get pcloud --fields label="password")
CRYPTO_PASS=$(op item get pcloud --fields label="crypto pass")
thanks