Skip to content

Commit

Permalink
Merge pull request #73 from iCrazeiOS/master
Browse files Browse the repository at this point in the history
Some fixes/improvements to device installation
  • Loading branch information
Kritanta authored Aug 26, 2021
2 parents c829718 + 79342db commit e22d863
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
6 changes: 4 additions & 2 deletions src/dragontools/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ def test_keybased_auth(self):
return system(f'ssh -o PasswordAuthentication=no -p {self.port} root@{self.host} 2>/dev/null "true"') == 0

def run_cmd(self, cmd, quiet=False):
if cmd == "none": return
if not quiet:
if cmd == '':
dbstate(f'No command entered.')
Expand Down Expand Up @@ -95,7 +96,7 @@ def setup_key_auth(self):
class DeviceManager(object):

def __init__(self):
with open(f'{os.environ["DRAGONBUILD"]}/internal/state.yml') as state:
with open(f'{os.environ["DRAGONDIR"]}/internal/state.yml') as state:
dragon_state = yaml.safe_load(state)

self.dragon_state = dragon_state
Expand All @@ -107,7 +108,7 @@ def __init__(self):
self.current = self.devices[dragon_state['device']['current']]

def savestate(self):
with open(f'{os.environ["DRAGONBUILD"]}/internal/state.yml', 'w') as state:
with open(f'{os.environ["DRAGONDIR"]}/internal/state.yml', 'w') as state:
yaml.dump(self.dragon_state, state)

def add_device(self, device: Device):
Expand Down Expand Up @@ -175,6 +176,7 @@ def main():
exit(0)
else:
dberror('Connection Failed')
dberror('Error connecting to device, make sure SSH is functioning properly')
exit(1)


Expand Down
9 changes: 7 additions & 2 deletions src/dragontools/shscripts/packaging
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@ send_package()
echo -e "${PrefixColor}[Dragon]${BoldColor} $1 not found${NC}"
drexit
fi
python3 -m dragontools.device test

connectionCheck="$(python3 -m dragontools.device test)"
if [[ $connectionCheck =~ "Failed" ]]; then
echo "$connectionCheck"
exit 1
fi

eval $(python3 -m dragontools.device get)

Expand All @@ -27,7 +32,7 @@ send_package()

echo -e "${PrefixColor}[Dragon]${BoldColor} Copying package to device and running install commands${NC}"
python3 -m dragontools.device qr mkdir -p /var/mobile/dragon/packages
scp -P $DRBPORT ${OUTPUT} root@$DRBIP:/var/mobile/dragon/${OUTPUT} || drexit && python3 -m dragontools.device qr dpkg -i /var/mobile/dragon/${OUTPUT} || drexit && python3 -m dragontools.device qr rm -rf /var/mobile/dragon/
scp -P $DRBPORT ${OUTPUT} root@$DRBIP:/var/mobile/dragon/${OUTPUT} || drexit && python3 -m dragontools.device qr dpkg -i /var/mobile/dragon/${OUTPUT} && rm -rf /var/mobile/dragon/
}

create_package()
Expand Down

0 comments on commit e22d863

Please sign in to comment.