fix sed for busybox
authorGuillaume Castagnino <casta@xwing.info>
Wed, 24 Apr 2019 14:01:13 +0000 (16:01 +0200)
committerGuillaume Castagnino <casta@xwing.info>
Wed, 24 Apr 2019 14:01:13 +0000 (16:01 +0200)
dist-font/cm-data/99-font.sh.addon [new file with mode: 0755]
dist-font/cm-data/ubuntu-font-family/Ubuntu-B.ttf [new file with mode: 0644]
dist-font/cm-data/ubuntu-font-family/Ubuntu-BI.ttf [new file with mode: 0644]
dist-font/cm-data/ubuntu-font-family/Ubuntu-C.ttf [new file with mode: 0644]
dist-font/cm-data/ubuntu-font-family/Ubuntu-L.ttf [new file with mode: 0644]
dist-font/cm-data/ubuntu-font-family/Ubuntu-LI.ttf [new file with mode: 0644]
dist-font/cm-data/ubuntu-font-family/Ubuntu-R.ttf [new file with mode: 0644]
dist-font/cm-data/ubuntu-font-family/Ubuntu-RI.ttf [new file with mode: 0644]
dist-font/cm.sh [new file with mode: 0755]

diff --git a/dist-font/cm-data/99-font.sh.addon b/dist-font/cm-data/99-font.sh.addon
new file mode 100755 (executable)
index 0000000..25a0dd1
--- /dev/null
@@ -0,0 +1,82 @@
+#!/sbin/sh
+#
+# ADDOND_VERSION=2
+#
+# /system/addon.d/99-font.sh
+#
+
+# we partially use the script at install, if so, $SYSTEM is allready defined
+if [ -z $SYSTEM ]; then
+  . /tmp/backuptool.functions
+else
+  S=$SYSTEM
+fi
+if [ -z $backuptool_ab ]; then
+  SYS=$S
+  TMP="/tmp"
+else
+  SYS="/postinstall/$S"
+  TMP="/postinstall/tmp"
+fi
+
+# path is needed when running from recovery (at install)
+export PATH="${PATH}:$S/bin:$S/xbin"
+
+list_files() {
+cat <<EOF
+fonts/Ubuntu-BI.ttf
+fonts/Ubuntu-B.ttf
+fonts/Ubuntu-C.ttf
+fonts/Ubuntu-LI.ttf
+fonts/Ubuntu-L.ttf
+fonts/Ubuntu-RI.ttf
+fonts/Ubuntu-R.ttf
+EOF
+}
+
+case "$1" in
+  backup)
+    list_files | while read FILE DUMMY; do
+      backup_file $S/"$FILE"
+    done
+  ;;
+  restore)
+    list_files | while read FILE REPLACEMENT; do
+      R=""
+      [ -n "$REPLACEMENT" ] && R="$S/$REPLACEMENT"
+      [ -f "$C/$S/$FILE" ] && restore_file $S/"$FILE" "$R"
+    done
+  ;;
+  pre-backup)
+    # Stub
+  ;;
+  post-backup)
+    # Stub
+  ;;
+  pre-restore)
+    # Stub
+  ;;
+  post-restore)
+    # update fonts.xml
+    cp "$SYS/etc/fonts.xml" "$SYS/etc/fonts.xml.bak"
+    sed -i -e "/Roboto-Thin.ttf/d" \
+        -e "/Roboto-ThinItalic.ttf/d" \
+        -e "s/Roboto-Light.ttf/Ubuntu-L.ttf/" \
+        -e "s/Roboto-LightItalic.ttf/Ubuntu-LI.ttf/" \
+        -e "s/Roboto-Regular.ttf/Ubuntu-R.ttf/" \
+        -e "s/Roboto-Italic.ttf/Ubuntu-RI.ttf/" \
+        -e "/Roboto-Medium.ttf/d" \
+        -e "/Roboto-MediumItalic.ttf/d" \
+        -e "/Roboto-Black.ttf/d" \
+        -e "/Roboto-BlackItalic.ttf/d" \
+        -e "s/Roboto-Bold.ttf/Ubuntu-B.ttf/" \
+        -e "s/Roboto-BoldItalic.ttf/Ubuntu-BI.ttf/" \
+        "$SYS/etc/fonts.xml"
+    # Fix ownership/permissions
+    for i in $(list_files); do
+      chown root:root "$SYS/$i"
+      chmod 644 "$SYS/$i"
+      chmod 755 "$(dirname "$SYS/$i")"
+    done
+  ;;
+esac
diff --git a/dist-font/cm-data/ubuntu-font-family/Ubuntu-B.ttf b/dist-font/cm-data/ubuntu-font-family/Ubuntu-B.ttf
new file mode 100644 (file)
index 0000000..b173da2
Binary files /dev/null and b/dist-font/cm-data/ubuntu-font-family/Ubuntu-B.ttf differ
diff --git a/dist-font/cm-data/ubuntu-font-family/Ubuntu-BI.ttf b/dist-font/cm-data/ubuntu-font-family/Ubuntu-BI.ttf
new file mode 100644 (file)
index 0000000..72a5a99
Binary files /dev/null and b/dist-font/cm-data/ubuntu-font-family/Ubuntu-BI.ttf differ
diff --git a/dist-font/cm-data/ubuntu-font-family/Ubuntu-C.ttf b/dist-font/cm-data/ubuntu-font-family/Ubuntu-C.ttf
new file mode 100644 (file)
index 0000000..602a3ee
Binary files /dev/null and b/dist-font/cm-data/ubuntu-font-family/Ubuntu-C.ttf differ
diff --git a/dist-font/cm-data/ubuntu-font-family/Ubuntu-L.ttf b/dist-font/cm-data/ubuntu-font-family/Ubuntu-L.ttf
new file mode 100644 (file)
index 0000000..ed0f5bc
Binary files /dev/null and b/dist-font/cm-data/ubuntu-font-family/Ubuntu-L.ttf differ
diff --git a/dist-font/cm-data/ubuntu-font-family/Ubuntu-LI.ttf b/dist-font/cm-data/ubuntu-font-family/Ubuntu-LI.ttf
new file mode 100644 (file)
index 0000000..c6cec55
Binary files /dev/null and b/dist-font/cm-data/ubuntu-font-family/Ubuntu-LI.ttf differ
diff --git a/dist-font/cm-data/ubuntu-font-family/Ubuntu-R.ttf b/dist-font/cm-data/ubuntu-font-family/Ubuntu-R.ttf
new file mode 100644 (file)
index 0000000..d748728
Binary files /dev/null and b/dist-font/cm-data/ubuntu-font-family/Ubuntu-R.ttf differ
diff --git a/dist-font/cm-data/ubuntu-font-family/Ubuntu-RI.ttf b/dist-font/cm-data/ubuntu-font-family/Ubuntu-RI.ttf
new file mode 100644 (file)
index 0000000..4f2d2bc
Binary files /dev/null and b/dist-font/cm-data/ubuntu-font-family/Ubuntu-RI.ttf differ
diff --git a/dist-font/cm.sh b/dist-font/cm.sh
new file mode 100755 (executable)
index 0000000..172dc08
--- /dev/null
@@ -0,0 +1,28 @@
+#!/sbin/sh
+
+set -e
+
+# $SYSTEM set by the caller
+
+cd "$(dirname $0)"
+
+export PATH="${PATH}:${SYSTEM}/bin:${SYSTEM}/xbin"
+
+# install iptables script
+echo "Installing font"
+cp cm-data/ubuntu-font-family/Ubuntu*.ttf ${SYSTEM}/fonts/
+chown root:root ${SYSTEM}/fonts/Ubuntu*.ttf
+chmod 750 ${SYSTEM}/fonts/Ubuntu*.ttf
+
+# install restore script
+echo "Installing restore script"
+cp cm-data/99-font.sh.addon ${SYSTEM}/addon.d/99-font.sh
+chown root:root ${SYSTEM}/addon.d/99-font.sh
+chmod 755 ${SYSTEM}/addon.d/99-font.sh
+
+# call restore script post to remove bloat
+export SYSTEM
+${SYSTEM}/addon.d/99-font.sh post-restore
+
+echo "Done"
+