Skip to content

Commit

Permalink
添加deb包模板
Browse files Browse the repository at this point in the history
  • Loading branch information
gfdgd-xi committed Sep 2, 2023
1 parent d86cfc1 commit 42ed690
Show file tree
Hide file tree
Showing 50 changed files with 1,150 additions and 0 deletions.
10 changes: 10 additions & 0 deletions deb/debian-core/DEBIAN/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

set -e

. /usr/share/debconf/confmodule

if [ -n "$DEBIAN_SCRIPT_DEBUG" ]; then set -v -x; DEBIAN_SCRIPT_TRACE=1; fi
${DEBIAN_SCRIPT_TRACE:+ echo "#42#DEBUG# RUNNING $0 $*" 1>&2 }


8 changes: 8 additions & 0 deletions deb/debian-core/DEBIAN/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Package: live-filesystem-community-debian-core
Version: 2.0.0
Architecture: amd64
Maintainer: LinuxDeepin Project <[email protected]>, gfdgd xi<[email protected]>
Section: devel
Priority: extra
Conflicts: live-filesystem, live-filesystem-community-full, live-filesystem-community-tiny, live-filesystem-community-full-15.11, live-filesystem-community-debian, live-filesystem-community-debian-mini
Description: Deepin Community Live CD Debian Core
35 changes: 35 additions & 0 deletions deb/debian-core/DEBIAN/postinst
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/sh
# Copy needed firmware

. /usr/share/debconf/confmodule
db_get live/root_password && rootpw="$RET"
db_stop
sha256=`echo -n $rootpw | sha256sum | cut -d ' ' -f1`
if [ ! -f "/recovery/cryptauth" ]; then
mkdir -p /recovery
echo $sha256 > /recovery/cryptauth
chmod 0600 /recovery/cryptauth
fi


if [ -f /proc/modules ];then
# Need installer to override this file.
install -Dm644 /proc/modules /recovery/modules
fi

# set grub default value
if [ ! -f /etc/default/grub ];then
echo "No grub default configuration.Exit..." >&2
else
if grep -q '^GRUB_DEFAULT=' /etc/default/grub;then
sed -i "s|^GRUB_DEFAULT=.*|GRUB_DEFAULT=saved|g" /etc/default/grub
else
cat >> /etc/default/grub << EOF
# Important change by live-filesystem.
GRUB_DEFAULT=saved
EOF
fi
update-grub || true
fi

exit 0
16 changes: 16 additions & 0 deletions deb/debian-core/DEBIAN/postrm
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash
case "${1}" in
remove)
. /usr/share/debconf/confmodule
# Remove my changes to the db.
db_purge
rm -f /recovery/cryptauth
rm -f /recovery/modules
# Update grub
if [ -e /boot/grub/grub.cfg ] && [ -x "$(which update-grub)" ]; then
update-grub
fi
;;
esac

exit 0
20 changes: 20 additions & 0 deletions deb/debian-core/DEBIAN/templates
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Template: live/root_password
Type: password
Description: Please enter a password for LIVE system:
To secure your system, it is recommended to set a password for the LIVE system
if the password is empty, no password is required to enter the LIVE system.
Description-zh_CN.UTF-8: 请输入LIVE系统的密码:
为了保障您的系统安全,建议为LIVE系统设置密码, 如果密码为空,则进入LIVE系统时不需要密码。

Template: live/root_password_again
Type: password
Description: Repeat password for LIVE system:
Description-zh_CN.UTF-8: 请再次输入密码:

Template: live/password_mismatch
Type: error
Description: Password input error
The two passwords you entered were not the same. Please try again.
Description-zh_CN.UTF-8: 输入密码错误
两次输入密码不同,请重新输入。

Empty file.
Empty file.
9 changes: 9 additions & 0 deletions deb/debian-core/etc/grub.d/01_live
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/sh
cat <<EOF
if [ ! -z \${boot_once} ];then
set timeout_style=countdown
set load_config=load-config
else
set load_config=
fi
EOF
132 changes: 132 additions & 0 deletions deb/debian-core/etc/grub.d/15_linux_bar
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
#! /bin/sh
set -e

# grub-mkconfig helper script.
# Copyright (C) 2006,2007,2008,2009,2010 Free Software Foundation, Inc.
#
# GRUB is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# GRUB is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GRUB. If not, see <http://www.gnu.org/licenses/>.

prefix="/usr"
exec_prefix="/usr"
datarootdir="/usr/share"
quiet_boot="0"

. "$pkgdatadir/grub-mkconfig_lib"

export TEXTDOMAIN=grub
export TEXTDOMAINDIR="${datarootdir}/locale"

CLASS="--class gnu-linux --class gnu --class os"

if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then
OS=GNU/Linux
else
CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr 'A-Z' 'a-z' | cut -d' ' -f1|LC_ALL=C sed 's,[^[:alnum:]_],_,g') ${CLASS}"
fi

if [ -f /etc/default/locale ];then
LOCALE=$(cat /etc/default/locale | grep ^LANG=.*$ | head -n 1 | sed 's/"//g')
LOCALE=${LOCALE#LANG=}
fi

LOCALE=${LOCALE:-en_US.UTF-8}

title_correction_code=

linux_entry ()
{
os="$1"
version="$2"
type="$3"
args="boot=live \$load_config components quiet toram locales=${LOCALE} acpi_backlight=vendor"

if [ -z "$boot_device_id" ]; then
boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")"
fi
args="$args live-media-path=recovery_live"
echo "menuentry 'uos Recovery' ${CLASS} \$menuentry_id_option 'gnulinux-simple-$boot_device_id' {" | sed "s/^/$submenu_indentation/"

echo " insmod gzio" | sed "s/^/$submenu_indentation/"

if [ x$dirname = x/ ]; then
if [ -z "${prepare_root_cache}" ]; then
prepare_root_cache="$(prepare_grub_to_access_device ${GRUB_DEVICE} | grub_add_tab)"
fi
printf '%s\n' "${prepare_root_cache}" | sed "s/^/$submenu_indentation/"
else
if [ -z "${prepare_boot_cache}" ]; then
prepare_boot_cache="$(prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | grub_add_tab)"
fi
printf '%s\n' "${prepare_boot_cache}" | sed "s/^/$submenu_indentation/"
fi
if [ x"$quiet_boot" = x0 ] || [ x"$type" != xsimple ]; then
message="$(gettext_printf "Loading Linux %s ..." ${version})"
sed "s/^/$submenu_indentation/" << EOF
EOF
fi
if test -d /sys/firmware/efi && test -e "${linux}.efi.signed"; then
sed "s/^/$submenu_indentation/" << EOF
linux ${rel_dirname}/${basename}.efi.signed ro ${args}
EOF
else
sed "s/^/$submenu_indentation/" << EOF
linux ${rel_dirname}/${basename} ro ${args}
EOF
fi
if test -n "${initrd}" ; then
# TRANSLATORS: ramdisk isn't identifier. Should be translated.
if [ x"$quiet_boot" = x0 ] || [ x"$type" != xsimple ]; then
message="$(gettext_printf "Loading initial ramdisk ...")"
sed "s/^/$submenu_indentation/" << EOF
EOF
fi
sed "s/^/$submenu_indentation/" << EOF
initrd ${rel_dirname}/${initrd}
EOF
fi
sed "s/^/$submenu_indentation/" << EOF
}
EOF
}

submenu_indentation=""
is_top_level=true
for i in /boot/deepin/vmlinuz-*; do
if grub_file_is_not_garbage "$i" ; then list="$list $i" ; fi
done

linux=`version_find_latest $list`

gettext_printf "Found deepin image: %s\n" "$linux" >&2
basename=`basename $linux`
dirname=`dirname $linux`
rel_dirname=`make_system_path_relative_to_its_root $dirname`
version=`echo $basename | sed -e "s,^[^0-9]*-,,g"`
alt_version=`echo $version | sed -e "s,\.old$,,g"`

initrd=
for i in "initrd.img-${version}"; do
if test -e "${dirname}/${i}" ; then
initrd="$i"
break
fi
done

if test -n "${initrd}" ; then
gettext_printf "Found initrd image: %s\n" "${dirname}/${initrd}" >&2
fi

linux_entry "${OS}" "${version}" simple

echo "$title_correction_code"
Empty file.
10 changes: 10 additions & 0 deletions deb/debian/DEBIAN/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

set -e

. /usr/share/debconf/confmodule

if [ -n "$DEBIAN_SCRIPT_DEBUG" ]; then set -v -x; DEBIAN_SCRIPT_TRACE=1; fi
${DEBIAN_SCRIPT_TRACE:+ echo "#42#DEBUG# RUNNING $0 $*" 1>&2 }


8 changes: 8 additions & 0 deletions deb/debian/DEBIAN/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Package: live-filesystem-community-debian
Version: 2.0.0
Architecture: amd64
Maintainer: LinuxDeepin Project <[email protected]>, gfdgd xi<[email protected]>
Section: devel
Priority: extra
Conflicts: live-filesystem, live-filesystem-community-full, live-filesystem-community-tiny, live-filesystem-community-full-15.11, live-filesystem-community-mini, live-filesystem-community-debian-core
Description: Deepin Community Live CD Debian
35 changes: 35 additions & 0 deletions deb/debian/DEBIAN/postinst
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/sh
# Copy needed firmware

. /usr/share/debconf/confmodule
db_get live/root_password && rootpw="$RET"
db_stop
sha256=`echo -n $rootpw | sha256sum | cut -d ' ' -f1`
if [ ! -f "/recovery/cryptauth" ]; then
mkdir -p /recovery
echo $sha256 > /recovery/cryptauth
chmod 0600 /recovery/cryptauth
fi


if [ -f /proc/modules ];then
# Need installer to override this file.
install -Dm644 /proc/modules /recovery/modules
fi

# set grub default value
if [ ! -f /etc/default/grub ];then
echo "No grub default configuration.Exit..." >&2
else
if grep -q '^GRUB_DEFAULT=' /etc/default/grub;then
sed -i "s|^GRUB_DEFAULT=.*|GRUB_DEFAULT=saved|g" /etc/default/grub
else
cat >> /etc/default/grub << EOF
# Important change by live-filesystem.
GRUB_DEFAULT=saved
EOF
fi
update-grub || true
fi

exit 0
16 changes: 16 additions & 0 deletions deb/debian/DEBIAN/postrm
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash
case "${1}" in
remove)
. /usr/share/debconf/confmodule
# Remove my changes to the db.
db_purge
rm -f /recovery/cryptauth
rm -f /recovery/modules
# Update grub
if [ -e /boot/grub/grub.cfg ] && [ -x "$(which update-grub)" ]; then
update-grub
fi
;;
esac

exit 0
20 changes: 20 additions & 0 deletions deb/debian/DEBIAN/templates
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Template: live/root_password
Type: password
Description: Please enter a password for LIVE system:
To secure your system, it is recommended to set a password for the LIVE system
if the password is empty, no password is required to enter the LIVE system.
Description-zh_CN.UTF-8: 请输入LIVE系统的密码:
为了保障您的系统安全,建议为LIVE系统设置密码, 如果密码为空,则进入LIVE系统时不需要密码。

Template: live/root_password_again
Type: password
Description: Repeat password for LIVE system:
Description-zh_CN.UTF-8: 请再次输入密码:

Template: live/password_mismatch
Type: error
Description: Password input error
The two passwords you entered were not the same. Please try again.
Description-zh_CN.UTF-8: 输入密码错误
两次输入密码不同,请重新输入。

Empty file.
Empty file.
9 changes: 9 additions & 0 deletions deb/debian/etc/grub.d/01_live
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/sh
cat <<EOF
if [ ! -z \${boot_once} ];then
set timeout_style=countdown
set load_config=load-config
else
set load_config=
fi
EOF
Loading

0 comments on commit 42ed690

Please sign in to comment.