Ubuntu 18.10,Samba 4.8.4 smb.conf - fruit:model 的有效值是什么?

Ubuntu 18.10,Samba 4.8.4 smb.conf - fruit:model 的有效值是什么?

我正在从运行 Mojave 的 macOS 客户端访问全新安装的 Ubuntu 18.10 和 Samba 4.8.4。通过 SMB 连接时,我希望 Finder 图标看起来像 Mac Mini(因为 Ubuntu 18.10 正在其上运行)。

/etc/samba/smb.conf[global]部分)中,这些值fruit:model起作用:

  • Xserve
  • MacPro
  • iMac

所有这些值也都有效,但结果是默认图标(看起来像 Apple Cinema Display):

  • MacBook
  • MacMini
  • MacSamba
  • TimeCapsule
  • RackMac

看到一篇帖子推荐 Mac 上的型号名称/System/Library/CoreServices/CoreTypes.bundle/Contents/Info.plist。虽然那里有很多,但我试过的那些都没有用。

回复:avahi-daemon,Samba 4.8.4 可以在不运行 avahi-daemon 的情况下为连接的 macOS 客户端设置图标(适用于上述三种型号)。虽然使用 avahi-daemon 有助于服务器在 Finder 中永久可见,但我试图仅了解fruit:model中的工作值smb.conf

有人有任何见解吗?

答案1

还有许多其他模型字符串可以作为值;我相信它们是直接从中读取的/System/Library/CoreServices/CoreTypes.bundle/Contents/Info.plist

浏览该文件,你应该能够直观地了解有效值。例如,从以下行

UTTypeTagSpecification = { com.apple.device-model-code = ( "Macmini", "Macmini5", "Macmini6", "Macmini7" ); };

我推断出迷你苹果电脑Macmini(无 CamelCase)。MacBook应该可以工作。正如上述文件中出现的AppleTVMacBook5,2和更多内容一样。

答案2

可以使用以下 Python 脚本来获取最新的可用模型。

import plistlib
from contextlib import suppress

types = plistlib.load(open("/System/Library/CoreServices/CoreTypes.bundle/Contents/Info.plist", "rb"))

models = []
for uttype in types['UTExportedTypeDeclarations']:
    with suppress(KeyError):
        model = uttype['UTTypeTagSpecification']['com.apple.device-model-code']
        if isinstance(model, str):
            models.append(model)
        else:
            models.extend(model)
fmt = ""
i = 4
models.sort()
prev = models[0][:i]

for model in models:
    if prev != (prev:=model[:i]):
        fmt += "\n\n"
    fmt += f"{model}, "
    
print(fmt)

‘fruit:model’ 参数当前可用的值是:

ADP2,1, 

ADP3,2, 

AirPort, AirPort4, AirPort4,102, AirPort4,107, AirPort5, AirPort5,104, AirPort5,105, AirPort5,108, AirPort5,114, AirPort5,117, AirPort6, AirPort6,106, AirPort7,120, 

AppleTV, AppleTV1,1, 

D201AP, D201AP, D201AP, 

D20AP, D20AP, D20AP, 

D211AP, D211AP, D211AP, 

D21AP, D21AP, D21AP, 

D221AP, D221AP, 

D22AP, D22AP, 

K48AP, 

Laptop, 

M68AP, 

MacBook, MacBook1,1, MacBook1,1,Black, MacBook1,1,White, MacBook10,1@ECOLOR=157,157,160, MacBook10,1@ECOLOR=217,180,154, MacBook10,1@ECOLOR=225,225,223, MacBook10,1@ECOLOR=232,201,195, MacBook10,1@ECOLOR=235,215,191, MacBook2,1, MacBook2,1,Black, MacBook2,1,White, MacBook3,1, MacBook3,1,Black, MacBook3,1,White, MacBook4,1, MacBook4,1,Black, MacBook4,1,White, MacBook5,1, MacBook5,2, MacBook6,1, MacBook7,1, MacBook8,1, MacBook8,1@ECOLOR=155,158,159, MacBook8,1@ECOLOR=157,157,160, MacBook8,1@ECOLOR=225,225,223, MacBook8,1@ECOLOR=235,215,191, MacBook9,1, MacBook9,1@ECOLOR=157,157,160, MacBook9,1@ECOLOR=225,225,223, MacBook9,1@ECOLOR=232,201,195, MacBook9,1@ECOLOR=235,215,191, MacBookAir, MacBookAir1,1, MacBookAir10,1, MacBookAir10,1@ECOLOR=1, MacBookAir10,1@ECOLOR=2, MacBookAir10,1@ECOLOR=3, MacBookAir2,1, MacBookAir3,1, MacBookAir3,2, MacBookAir4,1, MacBookAir4,2, MacBookAir5,1, MacBookAir5,2, MacBookAir6,1, MacBookAir6,2, MacBookAir7,1, MacBookAir7,2, MacBookAir8,1, MacBookAir8,1@ECOLOR=157,157,160, MacBookAir8,1@ECOLOR=217,180,154, MacBookAir8,1@ECOLOR=225,225,223, MacBookAir8,2, MacBookAir8,2@ECOLOR=157,157,160, MacBookAir8,2@ECOLOR=217,180,154, MacBookAir8,2@ECOLOR=225,225,223, MacBookAir9,1, MacBookAir9,1@ECOLOR=157,157,160, MacBookAir9,1@ECOLOR=217,180,154, MacBookAir9,1@ECOLOR=225,225,223, MacBookPro, MacBookPro1,1, MacBookPro1,2, MacBookPro10,1, MacBookPro10,2, MacBookPro11,1, MacBookPro11,2, MacBookPro11,3, MacBookPro11,4, MacBookPro11,5, MacBookPro12,1, MacBookPro13,1, MacBookPro13,1@ECOLOR=157,157,160, MacBookPro13,1@ECOLOR=225,225,223, MacBookPro13,2, MacBookPro13,2@ECOLOR=157,157,160, MacBookPro13,2@ECOLOR=225,225,223, MacBookPro13,3, MacBookPro13,3@ECOLOR=157,157,160, MacBookPro13,3@ECOLOR=225,225,223, MacBookPro14,1, MacBookPro14,1@ECOLOR=157,157,160, MacBookPro14,1@ECOLOR=225,225,223, MacBookPro14,2, MacBookPro14,2@ECOLOR=157,157,160, MacBookPro14,2@ECOLOR=225,225,223, MacBookPro14,3, MacBookPro14,3@ECOLOR=157,157,160, MacBookPro14,3@ECOLOR=225,225,223, MacBookPro15,1, MacBookPro15,1@ECOLOR=157,157,160, MacBookPro15,1@ECOLOR=225,225,223, MacBookPro15,2, MacBookPro15,2@ECOLOR=157,157,160, MacBookPro15,2@ECOLOR=225,225,223, MacBookPro15,3, MacBookPro15,3@ECOLOR=157,157,160, MacBookPro15,3@ECOLOR=225,225,223, MacBookPro15,4, MacBookPro15,4@ECOLOR=157,157,160, MacBookPro15,4@ECOLOR=225,225,223, MacBookPro16,1, MacBookPro16,1@ECOLOR=157,157,160, MacBookPro16,1@ECOLOR=225,225,223, MacBookPro16,2, MacBookPro16,2@ECOLOR=157,157,160, MacBookPro16,2@ECOLOR=225,225,223, MacBookPro16,3, MacBookPro16,3@ECOLOR=157,157,160, MacBookPro16,3@ECOLOR=225,225,223, MacBookPro16,4, MacBookPro16,4@ECOLOR=157,157,160, MacBookPro16,4@ECOLOR=225,225,223, MacBookPro17,1, MacBookPro17,1@ECOLOR=1, MacBookPro17,1@ECOLOR=2, MacBookPro2,1, MacBookPro2,2, MacBookPro3,1, MacBookPro4,1, MacBookPro5,1, MacBookPro5,2, MacBookPro5,3, MacBookPro5,4, MacBookPro5,5, MacBookPro6,1, MacBookPro6,2, MacBookPro7,1, MacBookPro8,1, MacBookPro8,2, MacBookPro8,3, MacBookPro9,1, MacBookPro9,2, 

MacPro, MacPro1,1, MacPro2,1, MacPro3,1, MacPro4,1, MacPro5,1, MacPro6,1, MacPro7,1, MacPro7,1@ECOLOR=225,225,223, MacPro7,1@ECOLOR=226,226,224, 

Macintosh, 

Macmini, Macmini1,1, Macmini2,1, Macmini3,1, Macmini4,1, Macmini5, Macmini6, Macmini7, Macmini8,1, Macmini9,1, 

N18AP, 

N45AP, 

N72AP, 

N81AP, 

N82AP, 

N88AP, 

N90AP, 

PowerBook, PowerBook3,2, PowerBook3,3, PowerBook3,4, PowerBook3,5, PowerBook5,1, PowerBook5,2, PowerBook5,3, PowerBook5,4, PowerBook5,5, PowerBook5,6, PowerBook5,7, PowerBook5,8, PowerBook5,9, PowerBook6,1, PowerBook6,2, PowerBook6,3, PowerBook6,4, PowerBook6,5, PowerBook6,7, PowerBook6,8, PowerMac, PowerMac10,1, PowerMac10,2, PowerMac11,2, PowerMac11,2,Quad, PowerMac12,1, PowerMac3,5, PowerMac3,6, PowerMac4,2, PowerMac4,4, PowerMac4,5, PowerMac6,1, PowerMac6,3, PowerMac6,4, PowerMac7,2, PowerMac7,3, PowerMac8,1, PowerMac8,2, PowerMac9,1, 

RackMac, RackMac1,1, RackMac1,2, RackMac3,1, RackMount, 

TimeCapsule, TimeCapsule6, TimeCapsule6,106, TimeCapsule6,109, TimeCapsule6,113, TimeCapsule6,116, TimeCapsule8,119, 

Tower, 

Watch, 

Windows, Windows2000, Windows2003, Windows2008, Windows7, WindowsVista, WindowsXP, 

Xserve, Xserve1,1, Xserve2,1, Xserve3,1, 

iMac, iMac10,1, iMac11,1, iMac11,2, iMac11,3, iMac12,1, iMac12,2, iMac13,1, iMac13,2, iMac13,3, iMac14,1, iMac14,2, iMac14,3, iMac14,4, iMac15,1, iMac16,1, iMac16,2, iMac17,1, iMac18,1, iMac18,2, iMac18,3, iMac19,1, iMac19,2, iMac20,1, iMac20,2, iMac21,1, iMac21,1@ECOLOR=1, iMac21,1@ECOLOR=3, iMac21,1@ECOLOR=4, iMac21,1@ECOLOR=5, iMac21,1@ECOLOR=6, iMac21,1@ECOLOR=7, iMac21,1@ECOLOR=8, iMac21,2, iMac21,2@ECOLOR=1, iMac21,2@ECOLOR=4, iMac21,2@ECOLOR=5, iMac21,2@ECOLOR=6, iMac4,1, iMac4,2, iMac5,1, iMac5,2, iMac6,1, iMac7,1, iMac8,1, iMac9,1, iMacPro1,1, 

iPad, iPad1,1, 

iPhone, iPhone, iPhone, iPhone, iPhone, iPhone, iPhone, iPhone, iPhone, iPhone1,1, iPhone1,2, iPhone10,1, iPhone10,1, iPhone10,1, iPhone10,2, iPhone10,2, iPhone10,2, iPhone10,3, iPhone10,3, iPhone10,4, iPhone10,4, iPhone10,4, iPhone10,5, iPhone10,5, iPhone10,5, iPhone10,6, iPhone10,6, iPhone2,1, iPhone3,1, 

iPod, iPod1,1, iPod2,1, iPod3,1, iPod4,1

记得重新启动 samba 和 avahi:

sudo service smbd restart
sudo avahi-daemon -k

以及通过按顺序按住Ctrl+并单击 Finder 来访问 Finder。Option

我还必须将“fruit:model”参数放在“smb.conf”的全局部分中。

答案3

Plist:/System/Library/CoreServices/CoreTypes.bundle/Contents/Info.plist

图标:/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/*.icns

相关内容