Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
ba1d870a
Kaydet (Commit)
ba1d870a
authored
Tem 03, 2015
tarafından
Nathan Yee
Kaydeden (comit)
Jan Holesovsky
Tem 03, 2015
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
online update: Remove unneeded files.
Change-Id: Id69448d893f7492e7321c6c6f84d6cccc9024220
üst
05806f46
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
2 additions
and
517 deletions
+2
-517
README
onlineupdate/README
+2
-2
moz.build
onlineupdate/source/libmar/sign/moz.build
+0
-24
moz.build
onlineupdate/source/libmar/src/moz.build
+0
-30
moz.build
onlineupdate/source/libmar/tool/moz.build
+0
-58
moz.build
onlineupdate/source/libmar/verify/moz.build
+0
-32
moz.build
onlineupdate/source/update/common/moz.build
+0
-29
moz.build
onlineupdate/source/update/src/moz.build
+0
-30
automounter_gonk.cxx
onlineupdate/source/update/updater/automounter_gonk.cxx
+0
-251
automounter_gonk.h
onlineupdate/source/update/updater/automounter_gonk.h
+0
-48
moz.build
onlineupdate/source/update/updater/moz.build
+0
-13
No files found.
onlineupdate/README
Dosyayı görüntüle @
ba1d870a
...
...
@@ -3,5 +3,5 @@ Online update implementation based on Mozilla's MAR format + update mechanism
Parts of this code are copied from the mozilla repository, and adapted to
LibreOffice needs:
firefox/modules/libmar -> online
-
update/source/libmar
firefox/toolkit/mozapps/update -> online
-
update/source/update
firefox/modules/libmar -> onlineupdate/source/libmar
firefox/toolkit/mozapps/update -> onlineupdate/source/update
onlineupdate/source/libmar/sign/moz.build
deleted
100644 → 0
Dosyayı görüntüle @
05806f46
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
Library
(
'signmar'
)
UNIFIED_SOURCES
+=
[
'mar_sign.c'
,
'nss_secutil.c'
,
]
FORCE_STATIC_LIB
=
True
LOCAL_INCLUDES
+=
[
'../src'
,
'../verify'
,
]
DEFINES
[
'MAR_NSS'
]
=
True
if
CONFIG
[
'OS_ARCH'
]
==
'WINNT'
:
USE_STATIC_LIBS
=
True
onlineupdate/source/libmar/src/moz.build
deleted
100644 → 0
Dosyayı görüntüle @
05806f46
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
EXPORTS
+=
[
'mar.h'
,
'mar_cmdline.h'
,
]
HOST_SOURCES
+=
[
'mar_create.c'
,
'mar_extract.c'
,
'mar_read.c'
,
]
HostLibrary
(
'hostmar'
)
Library
(
'mar'
)
UNIFIED_SOURCES
+=
[
'mar_create.c'
,
'mar_extract.c'
,
'mar_read.c'
,
]
FORCE_STATIC_LIB
=
True
if
CONFIG
[
'OS_ARCH'
]
==
'WINNT'
:
USE_STATIC_LIBS
=
True
onlineupdate/source/libmar/tool/moz.build
deleted
100644 → 0
Dosyayı görüntüle @
05806f46
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
HOST_SOURCES
+=
[
'mar.c'
,
]
HostProgram
(
'mar'
)
HOST_USE_LIBS
+=
[
'hostmar'
,
]
if
CONFIG
[
'MOZ_ENABLE_SIGNMAR'
]:
Program
(
'signmar'
)
SOURCES
+=
HOST_SOURCES
USE_LIBS
+=
[
'mar'
,
'signmar'
,
'verifymar'
,
]
for
var
in
(
'MAR_CHANNEL_ID'
,
'MOZ_APP_VERSION'
):
DEFINES
[
var
]
=
'"
%
s"'
%
CONFIG
[
var
]
if
CONFIG
[
'MOZ_ENABLE_SIGNMAR'
]:
USE_LIBS
+=
[
'nspr'
,
'nss'
,
]
else
:
DEFINES
[
'NO_SIGN_VERIFY'
]
=
True
if
CONFIG
[
'OS_ARCH'
]
==
'WINNT'
:
USE_STATIC_LIBS
=
True
OS_LIBS
+=
[
'ws2_32'
,
]
if
CONFIG
[
'MOZ_ENABLE_SIGNMAR'
]:
OS_LIBS
+=
[
'crypt32'
,
'advapi32'
,
]
elif
CONFIG
[
'OS_ARCH'
]
==
'Darwin'
:
OS_LIBS
+=
[
'-framework Security'
,
]
if
CONFIG
[
'HOST_OS_ARCH'
]
==
'WINNT'
:
HOST_OS_LIBS
+=
[
'ws2_32'
,
]
onlineupdate/source/libmar/verify/moz.build
deleted
100644 → 0
Dosyayı görüntüle @
05806f46
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
Library
(
'verifymar'
)
UNIFIED_SOURCES
+=
[
'cryptox.c'
,
'mar_verify.c'
,
]
FORCE_STATIC_LIB
=
True
if
CONFIG
[
'OS_ARCH'
]
==
'WINNT'
:
USE_STATIC_LIBS
=
True
elif
CONFIG
[
'OS_ARCH'
]
==
'Darwin'
:
UNIFIED_SOURCES
+=
[
'MacVerifyCrypto.cpp'
,
]
OS_LIBS
+=
[
'-framework Security'
,
]
else
:
DEFINES
[
'MAR_NSS'
]
=
True
LOCAL_INCLUDES
+=
[
'../sign'
]
LOCAL_INCLUDES
+=
[
'../src'
,
]
onlineupdate/source/update/common/moz.build
deleted
100644 → 0
Dosyayı görüntüle @
05806f46
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
EXPORTS
+=
[
'readstrings.h'
,
'updatedefines.h'
,
'updatelogging.h'
,
]
if
CONFIG
[
'MOZ_WIDGET_TOOLKIT'
]
==
'windows'
:
EXPORTS
+=
[
'pathhash.h'
,
'uachelper.h'
,
'updatehelper.cpp'
,
'updatehelper.h'
,
]
Library
(
'updatecommon'
)
srcdir
=
'.'
include
(
'sources.mozbuild'
)
FINAL_LIBRARY
=
'xul'
FAIL_ON_WARNINGS
=
True
onlineupdate/source/update/src/moz.build
deleted
100644 → 0
Dosyayı görüntüle @
05806f46
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
EXPORTS
+=
[
'mar.h'
,
'mar_cmdline.h'
,
]
HOST_SOURCES
+=
[
'mar_create.c'
,
'mar_extract.c'
,
'mar_read.c'
,
]
HostLibrary
(
'hostmar'
)
Library
(
'mar'
)
UNIFIED_SOURCES
+=
[
'mar_create.c'
,
'mar_extract.c'
,
'mar_read.c'
,
]
FORCE_STATIC_LIB
=
True
if
CONFIG
[
'OS_ARCH'
]
==
'WINNT'
:
USE_STATIC_LIBS
=
True
onlineupdate/source/update/updater/automounter_gonk.cxx
deleted
100644 → 0
Dosyayı görüntüle @
05806f46
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:set ts=2 sw=2 sts=2 et cindent: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include <android/log.h>
#include <cutils/android_reboot.h>
#include <errno.h>
#include <stdlib.h>
#include <sys/mount.h>
#include <sys/reboot.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include "automounter_gonk.h"
#include "updatedefines.h"
#include "updatelogging.h"
#define LOG_TAG "GonkAutoMounter"
#define GONK_LOG(level, format, ...) \
LOG((LOG_TAG ": " format "\n", ##__VA_ARGS__)); \
__android_log_print(level, LOG_TAG, format, ##__VA_ARGS__)
#define LOGI(format, ...) GONK_LOG(ANDROID_LOG_INFO, format, ##__VA_ARGS__)
#define LOGE(format, ...) GONK_LOG(ANDROID_LOG_ERROR, format, ##__VA_ARGS__)
const
char
*
kGonkMountsPath
=
"/proc/mounts"
;
const
char
*
kGonkSystemPath
=
"/system"
;
GonkAutoMounter
::
GonkAutoMounter
()
:
mDevice
(
nullptr
),
mAccess
(
Unknown
)
{
if
(
!
RemountSystem
(
ReadWrite
))
{
LOGE
(
"Could not remount %s as read-write."
,
kGonkSystemPath
);
}
}
GonkAutoMounter
::~
GonkAutoMounter
()
{
bool
result
=
RemountSystem
(
ReadOnly
);
free
(
mDevice
);
if
(
!
result
)
{
// Don't take any chances when remounting as read-only fails, just reboot.
Reboot
();
}
}
void
GonkAutoMounter
::
Reboot
()
{
// The android_reboot wrapper provides more safety, doing fancier read-only
// remounting and attempting to sync() the filesystem first. If this fails
// our only hope is to force a reboot directly without these protections.
// For more, see system/core/libcutils/android_reboot.c
LOGE
(
"Could not remount %s as read-only, forcing a system reboot."
,
kGonkSystemPath
);
LogFlush
();
if
(
android_reboot
(
ANDROID_RB_RESTART
,
0
,
nullptr
)
!=
0
)
{
LOGE
(
"Safe system reboot failed, attempting to force"
);
LogFlush
();
if
(
reboot
(
RB_AUTOBOOT
)
!=
0
)
{
LOGE
(
"CRITICAL: Failed to force restart"
);
}
}
}
static
const
char
*
MountAccessToString
(
MountAccess
access
)
{
switch
(
access
)
{
case
ReadOnly
:
return
"read-only"
;
case
ReadWrite
:
return
"read-write"
;
default
:
return
"unknown"
;
}
}
bool
GonkAutoMounter
::
RemountSystem
(
MountAccess
access
)
{
if
(
!
UpdateMountStatus
())
{
return
false
;
}
if
(
mAccess
==
access
)
{
return
true
;
}
unsigned
long
flags
=
MS_REMOUNT
;
if
(
access
==
ReadOnly
)
{
flags
|=
MS_RDONLY
;
// Give the system a chance to flush file buffers
sync
();
}
if
(
!
MountSystem
(
flags
))
{
return
false
;
}
// Check status again to verify /system has been properly remounted
if
(
!
UpdateMountStatus
())
{
return
false
;
}
if
(
mAccess
!=
access
)
{
LOGE
(
"Updated mount status %s should be %s"
,
MountAccessToString
(
mAccess
),
MountAccessToString
(
access
));
return
false
;
}
return
true
;
}
bool
GonkAutoMounter
::
UpdateMountStatus
()
{
FILE
*
mountsFile
=
NS_tfopen
(
kGonkMountsPath
,
"r"
);
if
(
mountsFile
==
nullptr
)
{
LOGE
(
"Error opening %s: %s"
,
kGonkMountsPath
,
strerror
(
errno
));
return
false
;
}
// /proc/mounts returns a 0 size from fstat, so we use the same
// pre-allocated buffer size that ADB does here
const
int
mountsMaxSize
=
4096
;
char
mountData
[
mountsMaxSize
];
size_t
read
=
fread
(
mountData
,
1
,
mountsMaxSize
-
1
,
mountsFile
);
mountData
[
read
+
1
]
=
'\0'
;
if
(
ferror
(
mountsFile
))
{
LOGE
(
"Error reading %s, %s"
,
kGonkMountsPath
,
strerror
(
errno
));
fclose
(
mountsFile
);
return
false
;
}
char
*
token
,
*
tokenContext
;
bool
foundSystem
=
false
;
for
(
token
=
strtok_r
(
mountData
,
"
\n
"
,
&
tokenContext
);
token
;
token
=
strtok_r
(
nullptr
,
"
\n
"
,
&
tokenContext
))
{
if
(
ProcessMount
(
token
))
{
foundSystem
=
true
;
break
;
}
}
fclose
(
mountsFile
);
if
(
!
foundSystem
)
{
LOGE
(
"Couldn't find %s mount in %s"
,
kGonkSystemPath
,
kGonkMountsPath
);
}
return
foundSystem
;
}
bool
GonkAutoMounter
::
ProcessMount
(
const
char
*
mount
)
{
const
int
strSize
=
256
;
char
mountDev
[
strSize
];
char
mountDir
[
strSize
];
char
mountAccess
[
strSize
];
int
rv
=
sscanf
(
mount
,
"%255s %255s %*s %255s %*d %*d
\n
"
,
mountDev
,
mountDir
,
mountAccess
);
mountDev
[
strSize
-
1
]
=
'\0'
;
mountDir
[
strSize
-
1
]
=
'\0'
;
mountAccess
[
strSize
-
1
]
=
'\0'
;
if
(
rv
!=
3
)
{
return
false
;
}
if
(
strcmp
(
kGonkSystemPath
,
mountDir
)
!=
0
)
{
return
false
;
}
free
(
mDevice
);
mDevice
=
strdup
(
mountDev
);
mAccess
=
Unknown
;
char
*
option
,
*
optionContext
;
for
(
option
=
strtok_r
(
mountAccess
,
","
,
&
optionContext
);
option
;
option
=
strtok_r
(
nullptr
,
","
,
&
optionContext
))
{
if
(
strcmp
(
"ro"
,
option
)
==
0
)
{
mAccess
=
ReadOnly
;
break
;
}
else
if
(
strcmp
(
"rw"
,
option
)
==
0
)
{
mAccess
=
ReadWrite
;
break
;
}
}
return
true
;
}
/*
* Mark the given block device as read-write or read-only, using the BLKROSET
* ioctl.
*/
static
void
SetBlockReadWriteStatus
(
const
char
*
blockdev
,
bool
setReadOnly
)
{
int
fd
;
int
roMode
=
setReadOnly
?
1
:
0
;
fd
=
open
(
blockdev
,
O_RDONLY
);
if
(
fd
<
0
)
{
return
;
}
if
(
ioctl
(
fd
,
BLKROSET
,
&
roMode
)
==
-
1
)
{
LOGE
(
"Error setting read-only mode on %s to %s: %s"
,
blockdev
,
setReadOnly
?
"true"
:
"false"
,
strerror
(
errno
));
}
close
(
fd
);
}
bool
GonkAutoMounter
::
MountSystem
(
unsigned
long
flags
)
{
if
(
!
mDevice
)
{
LOGE
(
"No device was found for %s"
,
kGonkSystemPath
);
return
false
;
}
// Without setting the block device ro mode to false, we get a permission
// denied error while trying to remount it in read-write.
SetBlockReadWriteStatus
(
mDevice
,
(
flags
&
MS_RDONLY
));
const
char
*
readOnly
=
flags
&
MS_RDONLY
?
"read-only"
:
"read-write"
;
int
result
=
mount
(
mDevice
,
kGonkSystemPath
,
"none"
,
flags
,
nullptr
);
if
(
result
!=
0
)
{
LOGE
(
"Error mounting %s as %s: %s"
,
kGonkSystemPath
,
readOnly
,
strerror
(
errno
));
return
false
;
}
LOGI
(
"Mounted %s partition as %s"
,
kGonkSystemPath
,
readOnly
);
return
true
;
}
onlineupdate/source/update/updater/automounter_gonk.h
deleted
100644 → 0
Dosyayı görüntüle @
05806f46
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:set ts=2 sw=2 sts=2 et cindent: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef AUTOMOUNTER_GONK_H__
#define AUTOMOUNTER_GONK_H__
typedef
enum
{
ReadOnly
,
ReadWrite
,
Unknown
}
MountAccess
;
/**
* This class will remount the /system partition as read-write in Gonk to allow
* the updater write access. Upon destruction, /system will be remounted back to
* read-only. If something causes /system to remain read-write, this class will
* reboot the device and allow the system to mount as read-only.
*
* Code inspired from AOSP system/core/adb/remount_service.c
*/
class
GonkAutoMounter
{
public
:
GonkAutoMounter
();
~
GonkAutoMounter
();
const
MountAccess
GetAccess
()
{
return
mAccess
;
}
private
:
bool
RemountSystem
(
MountAccess
access
);
bool
ForceRemountReadOnly
();
bool
UpdateMountStatus
();
bool
ProcessMount
(
const
char
*
mount
);
bool
MountSystem
(
unsigned
long
flags
);
void
Reboot
();
private
:
char
*
mDevice
;
MountAccess
mAccess
;
};
#endif // AUTOMOUNTER_GONK_H__
onlineupdate/source/update/updater/moz.build
deleted
100644 → 0
Dosyayı görüntüle @
05806f46
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
Program
(
'updater'
)
updater_rel_path
=
''
include
(
'updater-common.build'
)
if
CONFIG
[
'ENABLE_TESTS'
]:
DIRS
+=
[
'updater-xpcshell'
]
FAIL_ON_WARNINGS
=
True
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment