refs #596 unhardcode gitrelease
parent
ef212bc84e
commit
727cd1a666
|
@ -174,13 +174,10 @@ def btogGetOsInfo1 (type_client):
|
||||||
os.exit (1)
|
os.exit (1)
|
||||||
return osdistrib, oscodename, osrelease, osarch, oshttp
|
return osdistrib, oscodename, osrelease, osarch, oshttp
|
||||||
|
|
||||||
def btogGetOsInfo2 (type_client, versionboottools, osdistrib, oscodename, osrelease, osarch, oshttp):
|
def btogGetOsInfo2 (ogrepo_dir, versionboottools, oscodename, osrelease, osarch):
|
||||||
branch = 'master'
|
gitrelease = subprocess.run (['git', '--git-dir', f'{ogrepo_dir}/.git', 'log', '--date', 'format:r%Y%m%d', '--format=%ad', '-1'], capture_output=True, text=True).stdout.strip()
|
||||||
giturl = f'https://api.github.com/repos/opengnsys/OpenGnsys/commits?sha={branch}&path=/client'
|
|
||||||
gitrelease = 'r20240808' ## TODO: are we going to keep the following? $(curl -s "$GITURL" | jq -r '"r" + (.[0].commit.committer.date | split("-") | join("")[:8]) + "." + (.[0].sha[:7])')
|
|
||||||
nameisoclient ='-'.join ([versionboottools, oscodename, osrelease, osarch, gitrelease])
|
nameisoclient ='-'.join ([versionboottools, oscodename, osrelease, osarch, gitrelease])
|
||||||
namehostclient = '-'.join ([versionboottools, oscodename, gitrelease])
|
namehostclient = '-'.join ([versionboottools, oscodename, gitrelease])
|
||||||
|
|
||||||
return gitrelease, nameisoclient, namehostclient
|
return gitrelease, nameisoclient, namehostclient
|
||||||
|
|
||||||
def btogSetFsVirtual (btrootfsimg, btrootfsimglabel, btrootfsmnt, btvirtualdisksize, bttargetdir, osarch):
|
def btogSetFsVirtual (btrootfsimg, btrootfsimglabel, btrootfsmnt, btvirtualdisksize, bttargetdir, osarch):
|
||||||
|
|
|
@ -33,14 +33,10 @@ def _logging():
|
||||||
|
|
||||||
logger = _logging()
|
logger = _logging()
|
||||||
|
|
||||||
def clone_client_dirs():
|
def clone_client_dirs (ogrepo_url, ogrepo_branch, ogrepo_dir):
|
||||||
if not os.path.exists ('/tmp/opengnsys/engine'):
|
if not os.path.exists ('/tmp/opengnsys/engine'):
|
||||||
branch = 'main'
|
_run (['git', 'clone', '-c', 'http.sslVerify=false', '--branch', ogrepo_branch, ogrepo_url, ogrepo_dir])
|
||||||
tmpdir, _ = _run (['mktemp', '--tmpdir', '--directory', 'oggit.XXXXXX'])
|
_run (['rsync', '-aH', f'{ogrepo_dir}/client/engine', f'{ogrepo_dir}/client/shared', '/tmp/opengnsys/'])
|
||||||
logger.debug (f'tmpdir "{tmpdir}"')
|
|
||||||
_run (['git', 'clone', '-c', 'http.sslVerify=false', '--branch', branch, 'https://ognproject.evlt.uma.es/gitea/opengnsys/opengnsys.git', tmpdir])
|
|
||||||
_run (['rsync', '-aH', f'{tmpdir}/client/engine', f'{tmpdir}/client/shared', '/tmp/opengnsys/'])
|
|
||||||
_run (['rm', '-rf', tmpdir])
|
|
||||||
|
|
||||||
type_client = sys.argv[1] if len(sys.argv)>1 else 'host'
|
type_client = sys.argv[1] if len(sys.argv)>1 else 'host'
|
||||||
#WORKDIR = '/tmp/opengnsys_installer'
|
#WORKDIR = '/tmp/opengnsys_installer'
|
||||||
|
@ -54,13 +50,16 @@ if os.getuid():
|
||||||
#os.chdir ('/tmp')
|
#os.chdir ('/tmp')
|
||||||
|
|
||||||
logger.info ('OpenGnsys CLIENT installation begins')
|
logger.info ('OpenGnsys CLIENT installation begins')
|
||||||
clone_client_dirs()
|
ogrepo_url = 'https://ognproject.evlt.uma.es/gitea/opengnsys/opengnsys.git'
|
||||||
|
ogrepo_branch = 'main'
|
||||||
|
ogrepo_dir = '/tmp/ogrepo'
|
||||||
|
clone_client_dirs (ogrepo_url, ogrepo_branch, ogrepo_dir)
|
||||||
|
|
||||||
####################################################################3
|
####################################################################3
|
||||||
logger.info ('FASE 1 - Asignación de variables')
|
logger.info ('FASE 1 - Asignación de variables')
|
||||||
osdistrib, oscodename, osrelease, osarch, oshttp = btogGetOsInfo1(type_client)
|
osdistrib, oscodename, osrelease, osarch, oshttp = btogGetOsInfo1(type_client)
|
||||||
btdir, bttargetdir, btrootfsimg, btrootfsmnt, btrootfsimglabel, log_file, versionboottools, btvirtualdisksize = btogGetVar(osarch)
|
btdir, bttargetdir, btrootfsimg, btrootfsmnt, btrootfsimglabel, log_file, versionboottools, btvirtualdisksize = btogGetVar(osarch)
|
||||||
gitrelease, nameisoclient, namehostclient = btogGetOsInfo2(type_client, versionboottools, osdistrib, oscodename, osrelease, osarch, oshttp)
|
gitrelease, nameisoclient, namehostclient = btogGetOsInfo2(ogrepo_dir, versionboottools, oscodename, osrelease, osarch)
|
||||||
|
|
||||||
def _mount_rootfs():
|
def _mount_rootfs():
|
||||||
global btrootfsimg, btrootfsmnt
|
global btrootfsimg, btrootfsmnt
|
||||||
|
|
Loading…
Reference in New Issue