如何在 Ubuntu 16.10 上安装 Scratch 2。还是 17.04(64 位)?

Mar*_*tin 16 flash dpkg adobe-air 16.10 17.04

我需要使用离线 Scratch 2 在 Ubuntu 16.10/17.04 上安装 Adob​​e Air。Linux 多年来不支持 Air,因此有几种解决方法。一个对我有用到 Ubuntu 16.04(使用 Air 二进制安装程序):

# install i386 necessary libraries
$ sudo apt-get install libgtk2.0-0:i386 libstdc++6:i386 libxml2:i386 libxslt1.1:i386 libcanberra-gtk-module:i386 gtk2-engines-murrine:i386 libqt4-qt3support:i386 libgnome-keyring0:i386 libnss-mdns:i386 libnss3:i386
# install keyring
$ sudo apt-get install libgnome-keyring0:i386
# make keyring visible for Air
$ sudo ln -s /usr/lib/x86_64-linux-gnu/libgnome-keyring.so.0 /usr/lib/libgnome-keyring.so.0
$ sudo ln -s /usr/lib/x86_64-linux-gnu/libgnome-keyring.so.0.2.0 /usr/lib/libgnome-keyring.so.0.2.0 
# download Adobe Air installer
$ wget  http://airdownload.adobe.com/air/lin/download/2.6/AdobeAIRInstaller.bin
# run it
$ sudo chmod +x AdobeAIRInstaller.bin
$ sudo ./AdobeAIRInstaller.bin
Run Code Online (Sandbox Code Playgroud)

但在 16.10/17.4 上,它以安装程序错误结束:

无法安装 Adob​​e AIR。在系统上找不到用于创建 deb 包的 Debian 工具(例如 dpkg-deb 或 ar)。

这显然是错误的错误消息,dpkg-deb并且ar都安装了:

$ dpkg-deb --version
Debian 'dpkg-deb' package management program version 1.18.10 (amd64).
$ ar --version
GNU ar (GNU Binutils for Ubuntu) 2.28
Run Code Online (Sandbox Code Playgroud)

Adobe Air 安装日志文件来自 /root/.appdata/Adobe/AIR/Logs/Install.log

[setup:2506][INFO] Runtime Installer begin with version 2.6.0.19170 on Linux x86
[setup:2506][INFO] Commandline is: 
[setup:2506][INFO] No installed runtime detected
[setup:2506][INFO] Relaunching with elevation
[setup:2506][INFO] Launching subprocess with commandline /tmp/air.hp19kU/setup -ei
[setup:2525][INFO] Runtime Installer begin with version 2.6.0.19170 on Linux x86
[setup:2525][INFO] Commandline is: -stdio /tmp/air.KWo9tt/channel -ei
[setup:2525][INFO] No installed runtime detected
[setup:2525][INFO] Starting silent runtime install. Installing runtime version 2.6.0.19170
[setup:2525][INFO] Session detected: GNOME
[setup:2525][ERR] Error occurred during rpm create operation; beginning rollback: [ErrorEvent type="error" bubbles=false cancelable=false eventPhase=2 text="dpkg-query: package 'adobe-certs' is not installed and no information is available;Use dpkg --info (= dpkg-deb --info) to examine archive files,;and dpkg --contents (= dpkg-deb --contents) to list their contents.Could not run the command : ar" errorID=5031]
[setup:2525][INFO] Rollback complete
[setup:2525][ERR] Exiting due to error: [ErrorEvent type="error" bubbles=false cancelable=false eventPhase=2 text="dpkg-query: package 'adobe-certs' is not installed and no information is available;Use dpkg --info (= dpkg-deb --info) to examine archive files,;and dpkg --contents (= dpkg-deb --contents) to list their contents.Could not run the command : ar" errorID=5031]
[setup:2525][ERR] Runtime Installer end with exit code 7
[setup:2506][ERR] Exiting due to error: [ErrorEvent type="error" bubbles=false cancelable=false eventPhase=2 text="dpkg-query: package 'adobe-certs' is not installed and no information is available;Use dpkg --info (= dpkg-deb --info) to examine archive files,;and dpkg --contents (= dpkg-deb --contents) to list their contents.Could not run the command : ar" errorID=5031]
[setup:2506][ERR] Runtime Installer end with exit code 7
Run Code Online (Sandbox Code Playgroud)

所以我找到了另一种通过 deb 包安装 Adob​​e Air 的方法(我之前不知道):

$ wget http://airdownload.adobe.com/air/lin/download/2.6/adobeair.deb
$ sudo dpkg -i adobeair.deb
Run Code Online (Sandbox Code Playgroud)

瞧!Adobe Air 安装在 Ubuntu 16.10/17.04 上。
现在安装 Scratch 2。

# Find the latest Scratch AIR file link from https://scratch.mit.edu/scratch2download/
$ wget https://scratch.mit.edu/scratchr2/static/sa/Scratch-456.0.1.air
$ sudo Adobe\ AIR\ Application\ Installer ./Scratch-456.0.1.air 
Run Code Online (Sandbox Code Playgroud)

再次出现相同的错误:

无法安装 Adob​​e AIR。在系统上找不到用于创建 deb 包的 Debian 工具(例如 dpkg-deb 或 ar)。

安装日志

[Adobe AIR Application Installer:3197][INFO] Application Installer begin with version 2.6.0.19170 on Linux x86
[Adobe AIR Application Installer:3197][INFO] Commandline is: 
[Adobe AIR Application Installer:3197][INFO] Installed runtime (2.6.0.19170) located at /opt/Adobe AIR
[Adobe AIR Application Installer:3197][INFO] Unpackaging file:///home/administrator/Downloads/Scratch-456.0.1.air to /tmp/FlashTmp.LSCkv7
[Adobe AIR Application Installer:3197][INFO] Application signature verified
[Adobe AIR Application Installer:3197][INFO] Unpackaging/validation complete
[Adobe AIR Application Installer:3197][INFO] No app located for appID 'edu.media.mit.Scratch2Editor' and pubID ''
[Adobe AIR Application Installer:3197][INFO] Converting unpackaged application to a native installation package in /tmp/FlashTmp.RJSwfW
[Adobe AIR Application Installer:3197][ERR] Native installation package creation failed: [ErrorEvent type="error" bubbles=false cancelable=false eventPhase=2 text="Unhandled exception Error: Error creating the package Could not run the command : ar" errorID=5031]
[Adobe AIR Application Installer:3197][ERR] Application Installer end with exit code 7
Run Code Online (Sandbox Code Playgroud)

就像一个没有维护Adobe AIR的容貌不能起到新的dpkg-debar了。

在 Ubuntu 16.10/17.04 上有关于离线 Scratch 2 的任何提示吗?

Mar*_*tin 19

我一直在玩这几个小时。首先,我试图追踪Adobe Air Application Installer并发现里面发生了什么。

$ sudo strace -s 500 -t -o air_scratch.txt Adobe\ AIR/Versions/1.0/Adobe\ AIR\ Application\ Installer ~/Downloads/Scratch-456.0.1.air 
Run Code Online (Sandbox Code Playgroud)

我找到了这一行:

read(18, "dpkg-deb: error: treewalk root /tmp/FlashTmp.3TWnKI/build/DEBIAN is not a directory\n", 4096) = 84
Run Code Online (Sandbox Code Playgroud)

似乎新的dpkg不能像上一个那样处理链接。这可以通过在运行 Adob​​e Air Application Installer 之前放置~/air/bin/dpkg并更改PATH变量的包装脚本来解决。不幸的是,没有 sudo 就无法安装 Scratch,而更改PATH为 sudo 也不是那么容易。

然后我找到了一个不满意的纳税人的波兰论坛,他们正在解决类似的问题(他们需要在 Debian/Ubuntu 上运行财政部的一些 Air 应用程序):https : //forum.dug.ne​​t.pl/viewtopic.php?pid =310108

在这个论坛的深处,我找到了一些提示,如何在 Ubuntu 16.10/17.04 上运行 Scratch 2(即使没有adobeair.deb安装)。

这是我的最终工作解决方案,在干净安装上进行了测试。

# install necesary i386 libraries
$ sudo apt-get install libgtk2.0-0:i386 libstdc++6:i386 libxml2:i386 libxslt1.1:i386 libcanberra-gtk-module:i386 gtk2-engines-murrine:i386 libqt4-qt3support:i386 libgnome-keyring0:i386 libnss-mdns:i386 libnss3:i386

# make keyring visible for Adobe Air
$ sudo ln -s /usr/lib/i386-linux-gnu/libgnome-keyring.so.0 /usr/lib/libgnome-keyring.so.0
$ sudo ln -s /usr/lib/i386-linux-gnu/libgnome-keyring.so.0.2.0 /usr/lib/libgnome-keyring.so.0.2.0

# Download Adobe Air
cd ~/Downloads
wget http://airdownload.adobe.com/air/lin/download/2.6/AdobeAIRSDK.tbz2
$ sudo mkdir /opt/adobe-air-sdk
$ sudo tar jxf AdobeAIRSDK.tbz2 -C /opt/adobe-air-sdk

# Download Air runtime/SDK from Archlinux
wget https://aur.archlinux.org/cgit/aur.git/snapshot/adobe-air.tar.gz
$ sudo tar xvf adobe-air.tar.gz -C /opt/adobe-air-sdk
$ sudo chmod +x /opt/adobe-air-sdk/adobe-air/adobe-air

# Get actual scratch file URL from https://scratch.mit.edu/scratch2download/
$ sudo mkdir /opt/adobe-air-sdk/scratch
wget https://scratch.mit.edu/scratchr2/static/sa/Scratch-456.0.1.air
$ sudo cp Scratch-456.0.1.air /opt/adobe-air-sdk/scratch/
cp Scratch-456.0.1.air /tmp/
cd /tmp/
unzip /tmp/Scratch-456.0.1.air
$ sudo cp /tmp/icons/AppIcon128.png /opt/adobe-air-sdk/scratch/scratch.png
Run Code Online (Sandbox Code Playgroud)

创建启动器:

$ cat << _EOF_ > /usr/share/applications/Scratch2.desktop
[Desktop Entry]
Encoding=UTF-8
Version=1.0
Type=Application
Exec=/opt/adobe-air-sdk/adobe-air/adobe-air /opt/adobe-air-sdk/scratch/Scratch-456.0.1.air
Icon=/opt/adobe-air-sdk/scratch/scratch.png
Terminal=false
Name=Scratch 2
Comment=Programming system and content development tool
Categories=Application;Education;Development;ComputerScience;
MimeType=application/x-scratch-project
_EOF_

$ chmod +x /usr/share/applications/Scratch2.desktop
Run Code Online (Sandbox Code Playgroud)

就是这样。首次运行时间稍长,因为 Air 正在将 Scratch 2 应用程序解压到~/.appdata/edu.media.mit.Scratch2Editor文件夹中。

在 Ubuntu 17.04 上运行的 Scratch 2

  • 绝对的老大!做得好! (3认同)