diff options
author | Michael Olbrich <m.olbrich@pengutronix.de> | 2010-04-21 10:42:24 +0200 |
---|---|---|
committer | Michael Olbrich <m.olbrich@pengutronix.de> | 2010-04-21 14:04:52 +0200 |
commit | cfba6b285b7a3eb8ed5dc3a454ca7241c7ca5a24 (patch) | |
tree | b7f7791b259101f7138e067721bb7ec5222a02ad /bin | |
parent | e4dd94429c9022c7ce4493e9a7996c8b47b39ed0 (diff) | |
download | ptxdist-cfba6b285b7a3eb8ed5dc3a454ca7241c7ca5a24.tar.gz ptxdist-cfba6b285b7a3eb8ed5dc3a454ca7241c7ca5a24.tar.xz |
[ptxdist] copy previous ptxdistrc if current one is missing
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/ptxdist | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/bin/ptxdist b/bin/ptxdist index d088194e2..c9706c5a4 100755 --- a/bin/ptxdist +++ b/bin/ptxdist @@ -2074,6 +2074,25 @@ setup_env() { source "${PTXDIST_TOPDIR}/scripts/ptxdist_version.sh" && eval ptxrc="${PTXDIST_PTXRC_DEFAULT}" && + if [ ! -e "${ptxrc}" ]; then + local tmp_year="${PTXDIST_VERSION_YEAR}" + local tmp_month="${PTXDIST_VERSION_MONTH}" + while [ "${tmp_year}" -ge 2010 ]; do + local oldptxrc="${HOME}/.ptxdist/ptxdistrc-${tmp_year}.${tmp_month}" + if [ -e "${oldptxrc}" ]; then + cp "${oldptxrc}" "${ptxrc}" + break + fi + if [ "${tmp_month}" = "01" ]; then + tmp_month=12 + tmp_year=$[tmp_year-1] + else + tmp_month=${tmp_month#0} + tmp_month="$(printf "%02d" $[tmp_month-1])" + fi + done + fi + if [ -e "${ptxrc}" ]; then source "${ptxrc}" fi || return |