Skip to content

Commit

Permalink
Merge pull request #1 from Jesssullivan/devel
Browse files Browse the repository at this point in the history
+ systemd service & setup script, consolidated xbase depends.
  • Loading branch information
Jesssullivan authored Jul 26, 2020
2 parents 6a6e01e + 5d591b0 commit 9929eec
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 10 deletions.
14 changes: 10 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,20 @@ The trouble comes when you are trying to remote in- some problems you may encoun
***Patch it up:***

```
# install base depends:
sudo apt-get install xbase-clients
# get this script:
wget https://raw.githubusercontent.com/Jesssullivan/chrome-remote-desktop-budgie/master/chrome-remote-desktop
wget https://raw.githubusercontent.com/Jesssullivan/chrome-remote-desktop-budgie/devel/chrome-remote-desktop
# or:
git clone https://github.com/Jesssullivan/chrome-remote-desktop-budgie/
cd chrome-remote-desktop-budgie
git checkout devel
# behold:
python3 chrome-remote-desktop
# ...perhaps:
# sudo chmod u+x addsystemd.sh
# sudo ./addsystemd.sh
```

***What does this do?***
Expand Down
37 changes: 37 additions & 0 deletions addsystemd.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/bash
# Forceful server controls for chrome remote desktop.
# @ https://github.com/Jesssullivan/chrome-remote-desktop-budgie
# @ https://transscendsurvival.org/

# permiss:
# sudo chmod u+x addsystemd.sh

# run:
# sudo ./addsystemd.sh


if [[ $EUID -ne 0 ]]; then

echo "sudo is required to add crd_remote.service to systemd, aborting."

exit 1

fi

echo "copying service to /etc/systemd/system/crd_remote.service..."

cp -R crd_remote.service /etc/systemd/system/crd_remote.service

echo "permissing service...."

chmod 644 /etc/systemd/system/crd_remote.service

echo "starting service...."

systemctl start crd_remote

echo "checking service...."

systemctl status crd_remote >/dev/null

echo "done."
21 changes: 15 additions & 6 deletions chrome-remote-desktop
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,10 @@ class remote(object):
# or remote updates available on github-
# by comparing the checksums of the copies from
# gitub <--> /opt/ <--> /usr/local/bin

bin_path = '/usr/local/bin/'
binscript = bin_path + __name__
release = bin_path + __file__ + '.github'
binscript = bin_path + 'chrome-remote-desktop'
release = bin_path + 'chrome-remote-desktop.github'

# we fetch the latest crd binary here, should it need to be (re)installed
# we also copy the current distributed version for easy override
Expand All @@ -61,8 +62,12 @@ class remote(object):
subprocess.Popen('mkdir ' + tmp_path, shell=True).wait()

deb = tmp_path + '.crd.deb'

# note, 'xbase-clients' must already be installed
apt_depends = ['xvfb', 'xserver-xorg-video-dummy', 'xserver-xorg-input-void']
apt_depends = ['xbase-clients',
'xvfb',
'xserver-xorg-video-dummy',
'xserver-xorg-input-void']

@staticmethod
def _vprint(text):
Expand Down Expand Up @@ -137,9 +142,11 @@ class remote(object):
if script != remote.this_path:
cmd = str('sudo cp -R ' + remote.this_path + ' ' + script)
remote._execute(cmd)

# we all check the current github release here only to notify the user if there is
# a new script version. the new script is not automatically used, but is available in /bin/
# (__file__.new) alongside the existing script.

remote._vprint(text='fetching latest script release...')
subprocess.Popen(str(
'sudo wget -O ' + remote.release + ' ' +
Expand Down Expand Up @@ -167,6 +174,7 @@ class remote(object):

# remote.this_path will usually by the same as remote.binscript-
# systemctl should only be calling remote.binscript.

if hashes[remote.this_path] != hashes[remote.binscript]:
# in this scenario, $USER is likely running __file__ to set everything up
cmd = str('sudo cp -R ' + __file__ + ' ' + remote.binscript)
Expand Down Expand Up @@ -1969,7 +1977,8 @@ class SignalHandler:
if __name__ == "__main__":
if not os.path.abspath(__file__).startswith('/opt'):

if not os.path.exists(remote.crd_path):
# do not keep reinstalling each time launched via systemctl:
if 'local/bin' not in os.path.abspath(__file__):
remote.serve_install()
time.sleep(.1)

Expand All @@ -1981,10 +1990,10 @@ if __name__ == "__main__":
format="%(asctime)s:%(levelname)s:%(message)s")
main()

print('checking crd status & display value....\n')
print('remote: checking crd status & display value....\n')
remote.passed_crd(' --get-status')

print('enabling crd daemon....\n')
print('remote: checking crd daemon....\n')
remote.passed_crd(' --start')

logging.basicConfig(level=logging.DEBUG,
Expand Down

0 comments on commit 9929eec

Please sign in to comment.