@@ -14,7 +14,7 @@ if [ "$CURRENT" = "pi" -a "$FIRSTUSER" != "pi" ]; then
1414
1515 # first we need to figure out if we can use the new user name in systemd files
1616 # directly or if we need to use the UID - we do that by checking if the
17- # escaped name differes from the plain name, if so something is non ASCII
17+ # escaped name differs from the plain name, if so something is non ASCII
1818 # and the UID is the safer bet
1919 FIRSTUSERESC=` systemd-escape " $FIRSTUSER " `
2020 if [ " $FIRSTUSER " != " $FIRSTUSERESC " ]; then
@@ -29,6 +29,11 @@ if [ "$CURRENT" = "pi" -a "$FIRSTUSER" != "pi" ]; then
2929 sed -i " s!ExecStart=/home/pi/!ExecStart=$FIRSTUSERHOME /!g" /etc/systemd/system/octoprint.service
3030 systemctl daemon-reload
3131
32+ # fix virtualenv
33+ echo " Fixing paths in virtual environment"
34+ cd $FIRSTUSERHOME /oprint
35+ sudo -u $FIRSTUSER $FIRSTUSERHOME /.local/bin/virtualenv-tools --update-path $FIRSTUSERHOME /oprint
36+
3237 # fix sudoers files
3338 echo " Fixing sudoers"
3439 sed -i " s!^pi!$FIRSTUSER !g" /etc/sudoers.d/octoprint-service
@@ -39,12 +44,6 @@ if [ "$CURRENT" = "pi" -a "$FIRSTUSER" != "pi" ]; then
3944 sed -i " s!/home/pi/!$FIRSTUSERHOME /!g" $FIRSTUSERHOME /scripts/add-octoprint-checkout
4045 sed -i " s!/home/pi/!$FIRSTUSERHOME /!g" $FIRSTUSERHOME /scripts/welcome
4146 sed -i " s!/home/pi/!$FIRSTUSERHOME /!g" $FIRSTUSERHOME /.bashrc
42- sed -i " s!/home/pi/!$FIRSTUSERHOME /!g" /root/bin/webcamd
43-
44- # fix virtualenv
45- echo " Fixing paths in virtual environment"
46- cd $FIRSTUSERHOME /oprint
47- sudo -u $FIRSTUSER $FIRSTUSERHOME /.local/bin/virtualenv-tools --update-path $FIRSTUSERHOME /oprint
4847
4948 # finally, reboot for all of this to actually take affect
5049 echo " Adjusted scripts to new user, restarting services..."
0 commit comments