diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2011-11-16 10:40:09 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2011-11-16 10:40:09 +0000 |
commit | ce8a18b23231919a8b055126bcf989509e33c25f (patch) | |
tree | b2bebab46f794f32bc008ee1afc1e5429d40ff42 /setup-apkcache.in | |
parent | 631c361640d22e40d19b43d3b1e63b4da84ad18a (diff) | |
download | alpine-conf-ce8a18b23231919a8b055126bcf989509e33c25f.tar.bz2 alpine-conf-ce8a18b23231919a8b055126bcf989509e33c25f.tar.xz |
setup-apkcache: suggest /var/cache/apk as cache dir when not tmpfs root
Diffstat (limited to 'setup-apkcache.in')
-rw-r--r-- | setup-apkcache.in | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/setup-apkcache.in b/setup-apkcache.in index fd8e275..e462873 100644 --- a/setup-apkcache.in +++ b/setup-apkcache.in @@ -74,6 +74,13 @@ is_mounted_ro() { return 1 } +# get the fstype of the given mount point +mount_fstype() { + # we only want the last mount in case there are several + awk -v mnt="$1" '$2 == "/" {fstype = mnt} END {print fstype}' \ + /proc/mounts +} + apk_cache_help() { cat <<__EOF__ @@ -110,6 +117,10 @@ if [ -z "$suggestion" ] && [ -L /dev/usbdisk ]; then suggestion=/media/usb/cache fi +if [ -z "$suggestion" ] && [ "$(mount_fstype /)" != "tmpfs" ]; then + suggestion=/var/cache/apk +fi + if [ -z "$suggestion" ]; then suggestion=none fi |