Skip to content

Commit

Permalink
Fix issue when symlink is created in a non-existent directory.
Browse files Browse the repository at this point in the history
  • Loading branch information
RoliSoft committed Oct 16, 2016
1 parent fc39758 commit 4f09d42
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions install.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# coding=utf-8
import sys
import stat
import time
import atexit
import shutil
import struct
Expand Down Expand Up @@ -272,6 +273,10 @@ def retry_rw(operation, name, exc):

# create symlink manually

dirname = os.path.dirname(file.name)
if not os.path.exists(dirname):
os.makedirs(dirname, exist_ok=True)

with open(file.name, 'w', encoding='utf-8') as link:
link.write(file.linkname)

Expand Down Expand Up @@ -353,6 +358,8 @@ def retry_rw(operation, name, exc):

print('%s[*]%s Switching to new %srootfs%s...' % (Fore.GREEN, Fore.RESET, Fore.BLUE, Fore.RESET))

time.sleep(1)

try:
subprocess.check_output(['cmd', '/C', 'move', os.path.join(homedirw, 'rootfs-temp'), os.path.join(basedir, 'rootfs')])

Expand Down

0 comments on commit 4f09d42

Please sign in to comment.