Message ID | 1507125704-2423-2-git-send-email-sbabic@denx.de |
---|---|
State | Accepted |
Headers | show |
Series | [1/2] Add accessor to get script directory | expand |
Hi Stefano, I have applied the patches and now the problem is solved. The script file is going to /tmp/scripts folder. I tested using hawkbit, web server and local swupdates. Now it is fine. I think you can push the files to master. regards, Arun Sooraj PS On Wednesday, 4 October 2017 19:31:53 UTC+5:30, Stefano Babic wrote: > > Scripts were moved from TMPDIR to a separate directory, but they are still > extracted > into TMPDIR if the update is remote. > > Signed-off-by: Stefano Babic <sba...@denx.de <javascript:>> > --- > corelib/installer.c | 6 +++--- > corelib/stream_interface.c | 2 ++ > include/installer.h | 1 + > 3 files changed, 6 insertions(+), 3 deletions(-) > > diff --git a/corelib/installer.c b/corelib/installer.c > index 05a1f5a..9a91c10 100644 > --- a/corelib/installer.c > +++ b/corelib/installer.c > @@ -81,12 +81,12 @@ static int isImageInstalled(struct swver *sw_ver_list, > */ > int check_if_required(struct imglist *list, struct filehdr *pfdh, > struct swver *sw_ver_list, > + const char *destdir, > struct img_type **pimg) > { > int skip = SKIP_FILE; > struct img_type *img; > int img_skip = 0; > - const char* TMPDIR = get_tmpdir(); > > /* > * Check that not more as one image wnat to be streamed > @@ -116,8 +116,8 @@ int check_if_required(struct imglist *list, struct > filehdr *pfdh, > > if (snprintf(img->extract_file, > sizeof(img->extract_file), "%s%s", > - TMPDIR, pfdh->filename) >= > (int)sizeof(img->extract_file)) { > - ERROR("Path too long: %s%s", TMPDIR, > pfdh->filename); > + destdir, pfdh->filename) >= > (int)sizeof(img->extract_file)) { > + ERROR("Path too long: %s%s", destdir, > pfdh->filename); > return -EBADF; > } > /* > diff --git a/corelib/stream_interface.c b/corelib/stream_interface.c > index 404c116..988dc09 100644 > --- a/corelib/stream_interface.c > +++ b/corelib/stream_interface.c > @@ -188,6 +188,7 @@ static int extract_files(int fd, struct swupdate_cfg > *software) > > skip = check_if_required(&software->images, &fdh, > &software->installed_sw_list, > > + get_tmpdir(), > &img); > if (skip == SKIP_FILE) { > /* > @@ -196,6 +197,7 @@ static int extract_files(int fd, struct swupdate_cfg > *software) > */ > skip = > check_if_required(&software->scripts, &fdh, > NULL, > + get_tmpdirscripts(), > &img); > } > TRACE("Found file:\n\tfilename %s\n\tsize %d %s", > diff --git a/include/installer.h b/include/installer.h > index 971cc21..4e15f1e 100644 > --- a/include/installer.h > +++ b/include/installer.h > @@ -27,6 +27,7 @@ > > int check_if_required(struct imglist *list, struct filehdr *pfdh, > struct swver *sw_ver_list, > + const char *destdir, > struct img_type **pimg); > int install_images(struct swupdate_cfg *sw, int fdsw, int fromfile); > int install_single_image(struct img_type *img); > -- > 2.7.4 > >
Hi Arun, On 05/10/2017 15:38, Arun Sooraj PS wrote: > Hi Stefano, > > I have applied the patches and now the problem is solved. The script > file is going to /tmp/scripts folder. I tested using hawkbit, web server > and local swupdates. Now it is fine. I think you can push the files to > master. > ok - to track your work, too, is it ok if I add your Tested-by when I apply the patches ? That means the following in the commit message: Tested-by: Arun Sooraj PS <<arunsoorajj@gmail.com> Best regards, Stefano Babic
Yes, please do. Also if possible add me to the Google groups ML. I would also like to contribute... :-) Regards, Arun Sooraj P S On 5 Oct 2017 7:20 pm, "Stefano Babic" <sbabic@denx.de> wrote: > Hi Arun, > > On 05/10/2017 15:38, Arun Sooraj PS wrote: > > Hi Stefano, > > > > I have applied the patches and now the problem is solved. The script > > file is going to /tmp/scripts folder. I tested using hawkbit, web server > > and local swupdates. Now it is fine. I think you can push the files to > > master. > > > > ok - to track your work, too, is it ok if I add your Tested-by when I > apply the patches ? That means the following in the commit message: > > Tested-by: Arun Sooraj PS <<arunsoorajj@gmail.com> > > Best regards, > Stefano Babic > > > -- > ===================================================================== > DENX Software Engineering GmbH, Managing Director: Wolfgang Denk > HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany > Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic@denx.de > ===================================================================== >
diff --git a/corelib/installer.c b/corelib/installer.c index 05a1f5a..9a91c10 100644 --- a/corelib/installer.c +++ b/corelib/installer.c @@ -81,12 +81,12 @@ static int isImageInstalled(struct swver *sw_ver_list, */ int check_if_required(struct imglist *list, struct filehdr *pfdh, struct swver *sw_ver_list, + const char *destdir, struct img_type **pimg) { int skip = SKIP_FILE; struct img_type *img; int img_skip = 0; - const char* TMPDIR = get_tmpdir(); /* * Check that not more as one image wnat to be streamed @@ -116,8 +116,8 @@ int check_if_required(struct imglist *list, struct filehdr *pfdh, if (snprintf(img->extract_file, sizeof(img->extract_file), "%s%s", - TMPDIR, pfdh->filename) >= (int)sizeof(img->extract_file)) { - ERROR("Path too long: %s%s", TMPDIR, pfdh->filename); + destdir, pfdh->filename) >= (int)sizeof(img->extract_file)) { + ERROR("Path too long: %s%s", destdir, pfdh->filename); return -EBADF; } /* diff --git a/corelib/stream_interface.c b/corelib/stream_interface.c index 404c116..988dc09 100644 --- a/corelib/stream_interface.c +++ b/corelib/stream_interface.c @@ -188,6 +188,7 @@ static int extract_files(int fd, struct swupdate_cfg *software) skip = check_if_required(&software->images, &fdh, &software->installed_sw_list, + get_tmpdir(), &img); if (skip == SKIP_FILE) { /* @@ -196,6 +197,7 @@ static int extract_files(int fd, struct swupdate_cfg *software) */ skip = check_if_required(&software->scripts, &fdh, NULL, + get_tmpdirscripts(), &img); } TRACE("Found file:\n\tfilename %s\n\tsize %d %s", diff --git a/include/installer.h b/include/installer.h index 971cc21..4e15f1e 100644 --- a/include/installer.h +++ b/include/installer.h @@ -27,6 +27,7 @@ int check_if_required(struct imglist *list, struct filehdr *pfdh, struct swver *sw_ver_list, + const char *destdir, struct img_type **pimg); int install_images(struct swupdate_cfg *sw, int fdsw, int fromfile); int install_single_image(struct img_type *img);
Scripts were moved from TMPDIR to a separate directory, but they are still extracted into TMPDIR if the update is remote. Signed-off-by: Stefano Babic <sbabic@denx.de> --- corelib/installer.c | 6 +++--- corelib/stream_interface.c | 2 ++ include/installer.h | 1 + 3 files changed, 6 insertions(+), 3 deletions(-)