分类: 未分类

  • nexus开启https

    1. 生成证书
      我是用acme.sh申请免费证书,然后转换为java的keystore格式
      转换为pkcs12格式
      openssl pkcs12 -export -inkey example.key -in cert-chain.txt -out nexus.pkcs12
      生成keystore
      keytool -importkeystore -srckeystore nexus.pkcs12 -srcstoretype PKCS12 -destkeystore keystore.jks
    2. 把证书放在${jetty.etc}/ssl/keystore.jks
    3. 编辑nexus.properties
      data-dir/etc/nexus.properties中添加application-port-ssl=8443
      反注释nexus-args,确保它的值里面包含
      {jetty.etc}/jetty-https.xml
      添加ssl.etc={karaf.data}/etc/ssl(如果有这一行ssl目录会放在data目录下面,如果没有则放在{jetty.etc}里面)
    4. 编辑$install-dir/etc/jetty/jetty-https.xml
      有三处需要填写私钥密码
      指定私钥别名(这个不写也可以)
      jetty
    5. 在仓库管理里面把Base URL修改为域名
    6. 重启nexus

    注意:以上证书和配置文件需要权限正确
    参考:
    https://help.sonatype.com/repomanager3/nexus-repository-administration/capabilities/base-url-capability
    https://www.cnblogs.com/Smbands/p/14430775.html

    附件:
    nexus的docker-compose.yaml配置

    services:
      nexus:
        image: sonatype/nexus3
        restart: always
        hostname: nexus
        ports:
          - "8081:8081/tcp"
          - "8082:8082/tcp"
          - "8083:8083/tcp"
          - "8084:8084/tcp"
          - "8085:8085/tcp"
          - "80:8081/tcp"
          - "443:8443/tcp"
        volumes:
          - ./data:/nexus-data
          - ./deploy:/opt/sonatype/nexus/deploy
          - ./ssl:/opt/sonatype/nexus/etc/ssl
          - ./jetty-https.xml:/opt/sonatype/nexus/etc/jetty/jetty-https.xml
          - /etc/localtime:/etc/localtime
    
    

    Views: 174

  • nexus数据清理

    1. 进入Administration->repository->Cleanup Policies->Create Cleanup Policy
    2. 设置参数
      Name:输入一个名字
      Format:选择All Formats
      Component Age:第一次下载至今的天数
      Component Usage:最后一次下载至今的天数
      条件之间是and的关系,要所有条件同时满足才生效。
    3. 点save保存
    4. 进入Administration->System->Tasks->Create Task
    5. 类型选择Admin – Cleanup repositories using their associated policies
      Enabled:开启
      其它参数根据需要选择,这个Task默认就添加过的
    6. 类型选择Admin – Compact blob store
      Enabled:开启
      其它参数根据需要选择
    7. 设置仓库
      进入仓库的设置
      Cleanup Policies在应用上面仓库的clean策略

    参考:
    https://help.sonatype.com/repomanager3/nexus-repository-administration/repository-management/cleanup-policies

    Views: 59

  • groovy空值判断

    def a = null
    if (!a)
        println('a is empty')
    

    在groovy中null,false,”,0的布尔运算结果都是false,同样可以用!a进行反向判断

    Views: 16

  • powershell打包zip

    Compress-Archive -LiteralPath a.txt,b.txt -DestinationPath a.zip #仅打包文件,忽略路径
    Compress-Archive -Path a -DestinationPath a.zip
    Compress-Archive -Path a\*.txt -DestinationPath a.zip
    

    参考:
    https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.archive/compress-archive?view=powershell-7.3

    Views: 15

  • NSIS脚本说明

    page用来描述向导页

    MUI风格支持以下Page

    安装向导页

    MUI_PAGE_WELCOME 欢迎首页
    MUI_PAGE_LICENSE textfile 协议
    MUI_PAGE_COMPONENTS 组件选择
    MUI_PAGE_DIRECTORY 安装目录选择
    MUI_PAGE_STARTMENU pageid variable
    MUI_PAGE_INSTFILES
    MUI_PAGE_FINISH 结束页

    卸载向导页

    MUI_UNPAGE_WELCOME
    MUI_UNPAGE_CONFIRM
    MUI_UNPAGE_LICENSE textfile
    MUI_UNPAGE_COMPONENTS 组件选择
    MUI_UNPAGE_DIRECTORY 安装目录选择
    MUI_UNPAGE_INSTFILES
    MUI_UNPAGE_FINISH

    Section 区段

    用于定义每个组件安装和卸载时执行的脚本
    Section “Installer Section”
    some code
    SectionEnd

    Section “un.Uninstaller Section”
    some code
    SectionEnd

    关于Function

    函数分两种一种是用户自定义函数,需要用Call命令调用,一种是回调函数,是在特定的事件后或前自动调用的,所有的回调函数都以圆点开头,所有可用的回调函数参考这里:https://nsis.sourceforge.io/Docs/Chapter4.html#callbacks

    关于变量

    nsis变量用Var关键字定义,如:

    Var varA;

    然后在脚本中给变量赋值

    Section Install
    
    StrCpy $varA "123"
    
    Section End
    

    预定义常量

    • $PROGRAMFILES, $PROGRAMFILES32, $PROGRAMFILES64

    The program files directory (usually C:\Program Files but detected at runtime). On 64-bit Windows, PROGRAMFILES andPROGRAMFILES32 point to C:\Program Files (x86) while PROGRAMFILES64 points to C:\Program Files. UsePROGRAMFILES64 when installing 64-bit applications.

    • $COMMONFILES, $COMMONFILES32, $COMMONFILES64

    The common files directory. This is a directory for components that are shared across applications (usually C:\Program Files\Common Files but detected at runtime). On 64-bit Windows, COMMONFILES andCOMMONFILES32 point to C:\Program Files (x86)\Common Files while COMMONFILES64 points to C:\Program Files\Common Files. UseCOMMONFILES64 when installing 64-bit applications.

    • $DESKTOP

    The Windows desktop directory. The context of this constant (All Users or Current user) depends on the SetShellVarContext setting. The default is the current user.

    • $EXEDIR

    The directory containing the installer executable (technically this is a variable and you can modify it, but it is probably not a good idea).

    • $EXEFILE

    The base name of the installer executable.

    • $EXEPATH

    The full path of the installer executable.

    • ${NSISDIR}

    A symbol that contains the path where NSIS is installed. Useful if you want to reference resources that are in NSIS directory e.g. Icons, UIs etc.

    When compiled with support for keeping makensis and the data in the same place (the default on Windows), it is in the same place as makensis, on other platforms it is set at compile time (See the INSTALL file for info). In both instances you can modify it at runtime by setting the NSISDIR environment variable. See section 3.1.3 for more info.

    • $WINDIR

    The Windows directory (usually C:\Windows or C:\WinNT but detected at runtime).

    • $SYSDIR

    The Windows system directory (usually C:\Windows\System or C:\WinNT\System32 but detected at runtime).

    • $TEMP

    The temporary directory.

    • $STARTMENU

    The start menu folder (useful for adding start menu items using CreateShortcut). The context of this constant (All Users or Current user) depends on the SetShellVarContext setting. The default is the current user.

    • $SMPROGRAMS

    The start menu programs folder (use this whenever you want $STARTMENU\Programs). The context of this constant (All Users or Current user) depends on the SetShellVarContext setting. The default is the current user.

    • $SMSTARTUP

    The start menu programs / startup folder. The context of this constant (All Users or Current user) depends on the SetShellVarContext setting. The default is the current user.

    • $QUICKLAUNCH

    The quick launch folder for IE4 active desktop and above. If quick launch is not available it simply returns the same as $TEMP.

    • $DOCUMENTS

    The documents directory. A typical path for the current user is C:\Users\Foo\My Documents. The context of this constant (All Users or Current user) depends on the SetShellVarContext setting. The default is the current user.

    This constant is not available on Windows 95 unless Internet Explorer 4 is installed.

    • $SENDTO

    The directory that contains Send To menu shortcut items.

    • $RECENT

    The directory that contains shortcuts to the user’s recently used documents.

    • $FAVORITES

    The directory that contains shortcuts to the user’s favorite websites, documents, etc. The context of this constant (All Users or Current user) depends on the SetShellVarContext setting. The default is the current user.

    This constant is not available on Windows 95 unless Internet Explorer 4 is installed.

    • $MUSIC

    The user’s music files directory. The context of this constant (All Users or Current user) depends on the SetShellVarContext setting. The default is the current user.

    This constant is available on Windows ME, XP and above.

    • $PICTURES

    The user’s picture files directory. The context of this constant (All Users or Current user) depends on the SetShellVarContext setting. The default is the current user.

    This constant is available on Windows 2000, XP, ME and above.

    • $VIDEOS

    The user’s video files directory. The context of this constant (All Users or Current user) depends on the SetShellVarContext setting. The default is the current user.

    This constant is available on Windows ME, XP and above.

    • $NETHOOD

    The directory that contains link objects that may exist in the My Network Places/Network Neighborhood folder.

    This constant is not available on Windows 95 unless Internet Explorer 4 with Active Desktop is installed.

    • $FONTS

    The system’s fonts directory.

    • $TEMPLATES

    The document templates directory. The context of this constant (All Users or Current user) depends on the SetShellVarContext setting. The default is the current user.

    • $APPDATA

    The (roaming) application data directory.

    This constant is not available on Windows 95 unless Internet Explorer 4 with Active Desktop is installed.

    • $LOCALAPPDATA

    The local (non-roaming) application data directory. The context of this constant (All Users or Current user) depends on the SetShellVarContext setting. The default is the current user. The All Users location is also known as %ProgramData% on Vista and above.

    This constant is available on Windows ME, 2000 and above.

    • $PRINTHOOD

    The directory that contains link objects that may exist in the Printers folder.

    This constant is not available on Windows 95 and Windows 98.

    • $INTERNET_CACHE

    Internet Explorer’s temporary internet files directory.

    This constant is not available on Windows 95 nor Windows NT 4 unless Internet Explorer 4 with Active Desktop is installed.

    • $COOKIES

    Internet Explorer’s cookies directory.

    This constant is not available on Windows 95 nor Windows NT 4 unless Internet Explorer 4 with Active Desktop is installed.

    • $HISTORY

    Internet Explorer’s history directory.

    This constant is not available on Windows 95 nor Windows NT 4 unless Internet Explorer 4 with Active Desktop is installed.

    • $PROFILE

    The user’s profile directory. A typical path is C:\Users\Foo.

    This constant is available on Windows 2000 and above.

    • $ADMINTOOLS

    A directory where administrative tools are kept. The context of this constant (All Users or Current user) depends on the SetShellVarContext setting. The default is the current user.

    This constant is available on Windows 2000, ME and above.

    • $RESOURCES

    The resources directory that stores themes and other Windows resources (usually $WINDIR\Resources but detected at runtime).

    This constant is available on Windows XP and above.

    • $RESOURCES_LOCALIZED

    The localized resources directory that stores themes and other Windows resources (usually $WINDIR\Resources\1033 but detected at runtime).

    This constant is available on Windows XP and above.

    • $CDBURN_AREA

    A directory where files awaiting to be burned to CD are stored.

    This constant is available on Windows XP and above.

    • $HWNDPARENT

    HWND of the main window (in decimal).

    • $PLUGINSDIR

    The path to a temporary folder created upon the first usage of a plug-in or a call to InitPluginsDir. This folder is automatically deleted when the installer exits. This makes this folder the ideal folder to hold INI files for InstallOptions, bitmaps for the splash plug-in, or any other file that a plug-in needs to work.

    • $USER.. and $COMMON..

    A handful of constants are available as aliases that are not affected by SetShellVarContext: USERTEMPLATES,USERSTARTMENU, USERSMPROGRAMS,USERDESKTOP, COMMONTEMPLATES,COMMONSTARTMENU, COMMONSMPROGRAMS,COMMONDESKTOP and COMMONPROGRAMDATA.
    INSTDIR

    The installation directory (INSTDIR is modifiable using StrCpy, ReadRegStr, ReadINIStr, etc. – This could be used, for example, in the .onInit function to do a more advanced detection of install location).

    Note that in uninstaller code,INSTDIR contains the directory where the uninstaller lies. It does not necessarily contain the same value it contained in the installer. For example, if you write the uninstaller to WINDIR and the user doesn’t move it,INSTDIR will be WINDIR in the uninstaller. If you write the uninstaller to another location, you should keep the installer’sINSTDIR in the registry or an alternative storing facility and read it in the uninstaller.

    • $OUTDIR

    The current output directory (set implicitly via SetOutPath or explicitly via StrCpy, ReadRegStr, ReadINIStr, etc)

    • $CMDLINE

    The command line of the installer. The format of the command line can be one of the following:

    "full\path to\installer.exe" PARAMETER PARAMETER PARAMETER
    installer.exe PARAMETER PARAMETER PARAMETER
    For parsing out the PARAMETER portion, see GetParameters. If /D= is specified on the command line (to override the install directory) it won't show up in $CMDLINE.
    
    • $LANGUAGE

    The identifier of the language that is currently used. For example, English is 1033. You can only change this variable in .onInit.

    Views: 23

  • 世界,您好!

    欢迎使用WordPress。这是您的第一篇文章。编辑或删除它,然后开始写作吧!

    Views: 28176